🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #828

[PATCH] net: mdio: mdio-mux: fix device_node reference leak on success

#828
From: Haotian Zhang
Date: Thu, 08 Oct 2026 17:56
31 lines
6650 bytes
mdio_mux_init() obtains a reference to the parent bus device_node with
of_parse_phandle() when no mux_bus is passed in. All error paths release
it through err_parent_bus, but the success path at the end of the
function returns without calling of_node_put(). of_mdio_find_bus() only
takes a reference to the embedded struct device, so the device_node
reference is leaked for every multiplexer that probes successfully.

Release parent_bus_node before returning from the success path.

Fixes: 0ca2997d1452 ("netdev/of/phy: Add MDIO bus multiplexer support.")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/net/mdio/mdio-mux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/mdio/mdio-mux.c b/drivers/net/mdio/mdio-mux.c
index fe0e46bd7964..fe752120e27b 100644
--- a/drivers/net/mdio/mdio-mux.c
+++ b/drivers/net/mdio/mdio-mux.c
@@ -240,6 +240,7 @@ int mdio_mux_init(struct device *dev,
 	}
 	if (pb->children) {
 		*mux_handle = pb;
+		of_node_put(parent_bus_node);
 		return 0;
 	}
 
-- 
2.25.1
Technical Details
Message-ID: <20261008175612.2748920-1-vulab@iscas.ac.cn>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343177-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-343177-linux-kernel-netdev=dewy.ru
From: vulab@iscas.ac.cn (Haotian Zhang)
Newsgroups: linux.kernel.netdev
Subject: [PATCH] net: mdio: mdio-mux: fix device_node reference leak on success
Date: Fri,  9 Oct 2026 01:56:12 +0800
Organization: Usenet Network
Message-ID: <20261008175612.2748920-1-vulab@iscas.ac.cn>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="936475"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:1mckOenLlfqtCWeYxyglYDt+3u8= sha256:+Guf0hT7MHNALiXAY15zK/T3977q0LlK1ECKPEBbf50=
	sha1:3tD+RCAkYoa4epR4bD2QooY+PDU= sha256:bCuH1m8qivykV8FAQ5vo+g+P/TIJ9/GJ5wD19sTOiCQ=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 9D1A010F4AB; Thu,  8 Oct 2026 21:01:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.651
X-Spam-Status: No, score=-0.651 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id XUIfKC3Qq9EM;
	Thu,  8 Oct 2026 21:01:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-343177-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=iscas.ac.cn
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3D0AC10F4A8; Thu,  8 Oct 2026 21:01:01 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id B2794363F7; Thu,  8 Oct 2026 17:56:23 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DA6F3A6F1C;
	Thu,  8 Oct 2026 17:56:23 +0000 (UTC)
X-Received: from cstnet.cn (smtp81.cstnet.cn [159.226.251.81])
	(using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1AD83B38B9;
	Thu,  8 Oct 2026 17:56:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.81
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791482183; cv=none; b=JuSXYkjEG1yunPJQAgH/Mmh/jqTrcXBjeujypJHTYNGmde9VDa6J5Z5hHK9tD3NbhqRj18AaYw7hBJV6RN98w9BIwXUtx0DHJ1EYLliWj8Bs0dwzp5BwQFf8EyTLVUTj5Ut7rGGmpkahwEMtWrE4/I3M7Tey8sU6aie8/HBSVPs=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791482183; c=relaxed/simple;
	bh=edzsBnnHxbYxOo3OoR0PdT/k6aGpP3sirb68mDkhhgg=;
	h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MEFFQ5MCpJUF7UtGnQ+dP4HrozJjBZN+7VK6fuxqN2BgJmhqULQ2S2bWzV8nnaI+Abd5RAv+2hr+HcYp1a96sEVTm9VEGfB1Sa7HL/lgoafHcaA5rpkXZfaZi1rkIxm9xLQ3hRqeZ3z5U/o+aTVGS+m2wEXl8H3sbIqHrasyiXQ=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.81
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn
X-Received: from fc87d0ffb700.home.arpa (unknown [36.110.52.2])
	by APP-03 (Coremail) with SMTP id rQCowACnsD452cdqBN4PCg--.12700S2;
	Fri, 09 Oct 2026 01:56:09 +0800 (CST)
X-Cc: netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.25.1
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-CM-TRANSID: rQCowACnsD452cdqBN4PCg--.12700S2
X-Coremail-Antispam: 1UD129KBjvdXoW7GrWfXFy3XF15WF18CF17KFg_yoWkGrg_Gr
	n7Wr97Cw18GFsFyw47Cr4Sv393KFnruFWxWFsI9a98J393AF1UCr1DuwnxJ348CrWak3W5
	Cr1DJF4UX342gjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT
	9fnUUIcSsGvfJTRUUUbVAYjsxI4VWkKwAYFVCjjxCrM7AC8VAFwI0_Gr0_Xr1l1xkIjI8I
	6I8E6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM2
	8CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0
	cI8IcVCY1x0267AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I
	8E87Iv6xkF7I0E14v26r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xv
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