]> git.ipfire.org Git - thirdparty/linux.git/commit
net: ethernet: sunplus: spl2sw: fix phy_node refcount leak in remove
authorShitalkumar Gandhi <shital.gandhi45@gmail.com>
Tue, 23 Jun 2026 06:41:42 +0000 (12:11 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 25 Jun 2026 02:34:56 +0000 (19:34 -0700)
commita9e29dcd8a84081177f693439d663ca9e216c9fa
tree7ccc8e943644e89f419238deefa039369cf703bd
parent636838ebb74aa10b2195b60232ba3f49ff04d4f8
net: ethernet: sunplus: spl2sw: fix phy_node refcount leak in remove

mac->phy_node is acquired via of_parse_phandle() in spl2sw_probe() and
stored in the mac private data, transferring ownership of the
device_node reference to mac. On driver removal, spl2sw_phy_remove()
disconnects the PHY but never drops that reference, so each
probe-then-remove cycle leaks one of_node refcount per port permanently.

Drop the reference after phy_disconnect(). While at it, remove the
redundant inner "if (ndev)" check; comm->ndev[i] was just verified
non-NULL on the line above.

Compile-tested only; no SP7021 hardware available.

Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/f3bdd4c91f3e2269b4e256075f9dc70808b1b8e9.1782195965.git.shitalkumar.gandhi@cambiumnetworks.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/sunplus/spl2sw_phy.c