From: Johan Hovold <johan@kernel.org>
To: FUJITA Tomonori <fujita.tomonori@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, Johan Hovold <johan@kernel.org>,
stable@vger.kernel.org, Hans-Frieder Vogt <hfdevel@gmx.net>
Subject: [PATCH net] net: tn40xx: fix swnode use-after-free on probe failure
Date: Tue, 10 Nov 2026 11:00:51 +0100 [thread overview]
Message-ID: <20261110100051.2567443-1-johan@kernel.org> (raw)
The mdiobus allocated by tn40_mdiobus_init() has no primary firmware
node so its firmware node pointer points to the secondary software node
added by device_add_software_node() and whose reference is released by
device_remove_software_node().
Drop the stray firmware node reference decrement on probe failure and
driver unbind which leads to a use-after-free when deregistering the
software node group as the parent MDIO node has been freed before the
child PHY node.
Fixes: 25b6a6d29d40 ("net: tn40xx: create swnode for mdio and aqr105 phy and add to mdiobus")
Cc: stable@vger.kernel.org # 6.15
Cc: Hans-Frieder Vogt <hfdevel@gmx.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/net/ethernet/tehuti/tn40_mdio.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/tehuti/tn40_mdio.c b/drivers/net/ethernet/tehuti/tn40_mdio.c
index fb1a4a2e4dbc..49951477ac05 100644
--- a/drivers/net/ethernet/tehuti/tn40_mdio.c
+++ b/drivers/net/ethernet/tehuti/tn40_mdio.c
@@ -157,7 +157,6 @@ void tn40_swnodes_cleanup(struct tn40_priv *priv)
{
/* cleanup of swnodes is only needed for AQR105-based cards */
if (priv->pdev->device == PCI_DEVICE_ID_TEHUTI_TN9510) {
- fwnode_handle_put(dev_fwnode(&priv->mdio->dev));
device_remove_software_node(&priv->mdio->dev);
software_node_unregister_node_group(priv->nodes.group);
}
--
2.56.0
next reply other threads:[~2026-11-10 10:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 10:00 Johan Hovold [this message]
2026-11-10 10:06 ` [PATCH net] net: tn40xx: fix swnode use-after-free on probe failure netdev-bot+sinfo
2026-11-10 10:12 ` Johan Hovold
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=20261110100051.2567443-1-johan@kernel.org \
--to=johan@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=fujita.tomonori@gmail.com \
--cc=hfdevel@gmx.net \
--cc=kuba@kernel.org \
--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