From: Wentao Liang <vulab@iscas.ac.cn>
To: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] mdio-airoha: fix refcount leak in airoha_mdio_probe()
Date: Tue, 9 Jun 2026 09:07:29 +0000 [thread overview]
Message-ID: <20260609090729.219120-1-vulab@iscas.ac.cn> (raw)
In airoha_mdio_probe(), after calling reset_control_deassert(),
if clk_set_rate() fails, the function returns immediately without
calling reset_control_assert(). This leaves the reset line
deasserted and causes a reference count leak on shared reset
controllers. The devm cleanup does not assert the reset line, so
the unbalanced deassert persists.
Fix this by adding a reset_control_assert() call on the
clk_set_rate() error path, matching the existing error handling
for devm_of_mdiobus_register().
Cc: stable@vger.kernel.org
Fixes: 67e3ba978361 ("net: mdio: Add MDIO bus controller for Airoha AN7583")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/mdio/mdio-airoha.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mdio/mdio-airoha.c b/drivers/net/mdio/mdio-airoha.c
index 52e7475121ea..030482b8318f 100644
--- a/drivers/net/mdio/mdio-airoha.c
+++ b/drivers/net/mdio/mdio-airoha.c
@@ -245,8 +245,10 @@ static int airoha_mdio_probe(struct platform_device *pdev)
freq = 2500000;
ret = clk_set_rate(priv->clk, freq);
- if (ret)
+ if (ret) {
+ reset_control_assert(priv->reset);
return ret;
+ }
ret = devm_of_mdiobus_register(dev, bus, dev->of_node);
if (ret) {
--
2.34.1
next reply other threads:[~2026-06-09 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 9:07 Wentao Liang [this message]
2026-06-09 9:47 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260609090729.219120-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®