From: Wentao Liang <vulab@iscas.ac.cn>
To: andrew+netdev@lunn.ch
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
linux-kernel@vger.kernel.org, madalin.bucur@nxp.com,
netdev@vger.kernel.org, pabeni@redhat.com,
sean.anderson@linux.dev, Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] net: dpaa: Fix tbidev reference leak in dtsec_initialization()
Date: Thu, 17 Sep 2026 11:05:54 +0000 [thread overview]
Message-ID: <20260917110554.2148240-1-vulab@iscas.ac.cn> (raw)
dtsec_initialization() takes a reference on the PCS mdio device with
of_mdio_find_device(), but only releases it in dtsec_free(), which is
called from the error paths. The successful path returns without
dropping it, leaking the reference.
Release the reference once the PCS has been set up. The device stays
registered for as long as the FMan device, which mac_dev holds a
reference to.
Fixes: 5d93cfcf7360 ("net: dpaa: Convert to phylink")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/net/ethernet/freescale/fman/fman_dtsec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
index fe35703c509e..2a503bc5bc28 100644
--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
+++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
@@ -1492,6 +1492,12 @@ int dtsec_initialization(struct mac_device *mac_dev,
dev_info(mac_dev->dev, "FMan dTSEC version: 0x%08x\n",
ioread32be(&dtsec->regs->tsec_id));
+ /* The PCS device is registered as long as the FMan device, of which
+ * mac_dev holds a reference, so the reference taken above is not
+ * needed anymore.
+ */
+ put_device(&dtsec->tbidev->dev);
+
goto _return;
_return_fm_mac_free:
--
2.34.1
next reply other threads:[~2026-09-17 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 11:05 Wentao Liang [this message]
2026-09-21 12:04 ` netdev-bot+sashiko
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=20260917110554.2148240-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.anderson@linux.dev \
--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®