From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ED1C46A5EE; Tue, 21 Jul 2026 18:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658001; cv=none; b=BfqJDCNf3mHeaGH2wXFOwKTz0b+e7s6FVXOixPxWiauqmnJjnw25Gtl0F7pLbdzRhZwWlmBCj6oq103oao5SnoyQRMu9I64AorD+9d7lbJSxWtREwMjcyscrI/hhpxSs96ndtOaIAQxhug8qgx86oOZkg4pAKwDFDsCQYIyGryI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658001; c=relaxed/simple; bh=7VAdPhh0N6gQLhIXlFobxTLzl8UYUH5UO+lqjY7E5qc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TIw33fbk4Y9ckeZFw/p9+DQPGerMcST5SVx40EOzRO+Vz3dZ+leUfs7ee6B2n95kYFeNRKzjNU39MHwDiPVdou6FoP3KE8gvAUiVwMq/rza50cCfNmChd7Rc00UW6s28j0Xktv8skwuAN4WJa8NbAMOccfi/VRBDmUOIb2ZVMYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UA8QbJnW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UA8QbJnW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2CA91F000E9; Tue, 21 Jul 2026 18:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784658000; bh=WOuBpMOPxjvnMVNY2IV2/24ypAAKF5rVYe8CinVx/Qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UA8QbJnW9g0HxtTks9hL2YvciWESlJoPsOeMvDmgAkRg4qOvLJhwm5uLnbZhHZTHY fY4cJ3jo82hl95sPC6OhEOBJtGbqlTKYFxa943oHjWlpixHbyG+e3sGk3hDSZ78Ks8 Nov2jPF1zuk0U55AEaDtZr6zjXdUJ4YVXNU1lfL0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shitalkumar Gandhi , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18 0935/1611] net: ethernet: sunplus: spl2sw: fix phy_node refcount leak in remove Date: Tue, 21 Jul 2026 17:17:31 +0200 Message-ID: <20260721152536.418009064@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shitalkumar Gandhi [ Upstream commit a9e29dcd8a84081177f693439d663ca9e216c9fa ] 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 Reviewed-by: Andrew Lunn Link: https://patch.msgid.link/f3bdd4c91f3e2269b4e256075f9dc70808b1b8e9.1782195965.git.shitalkumar.gandhi@cambiumnetworks.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/sunplus/spl2sw_phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/sunplus/spl2sw_phy.c b/drivers/net/ethernet/sunplus/spl2sw_phy.c index 6f899e48f51dfb..a4889c52e00e4c 100644 --- a/drivers/net/ethernet/sunplus/spl2sw_phy.c +++ b/drivers/net/ethernet/sunplus/spl2sw_phy.c @@ -79,12 +79,14 @@ int spl2sw_phy_connect(struct spl2sw_common *comm) void spl2sw_phy_remove(struct spl2sw_common *comm) { struct net_device *ndev; + struct spl2sw_mac *mac; int i; for (i = 0; i < MAX_NETDEV_NUM; i++) if (comm->ndev[i]) { ndev = comm->ndev[i]; - if (ndev) - phy_disconnect(ndev->phydev); + mac = netdev_priv(ndev); + phy_disconnect(ndev->phydev); + of_node_put(mac->phy_node); } } -- 2.53.0