From: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
To: Boon Khai Ng <boon.khai.ng@altera.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>,
Michal Simek <michal.simek@amd.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH net 1/2] net: altera: Fix potential use-after-free on removal
Date: Tue, 17 Nov 2026 22:43:26 +0800 [thread overview]
Message-ID: <20261117-571e631490-net-1@mail.sdu.edu.cn> (raw)
In-Reply-To: <20261117-571e631490-net-0@mail.sdu.edu.cn>
Destroying the MDIO bus before unregistering a running network device
leaves its PHY attached to a freed bus. The subsequent shutdown path
calls phylink_disconnect_phy(), which can access that bus.
Unregister the network device before destroying the MDIO bus.
This issue was found by our static analysis tool under development.
Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
drivers/net/ethernet/altera/altera_tse_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index 9eed0be4411e..e203f9fcb5d7 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1461,8 +1461,8 @@ static void altera_tse_remove(struct platform_device *pdev)
struct altera_tse_private *priv = netdev_priv(ndev);
platform_set_drvdata(pdev, NULL);
- altera_tse_mdio_destroy(ndev);
unregister_netdev(ndev);
+ altera_tse_mdio_destroy(ndev);
phylink_destroy(priv->phylink);
lynx_pcs_destroy(priv->pcs);
--
2.43.0
next prev parent reply other threads:[~2026-11-17 14:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:42 [PATCH net 0/2] net: Keep MDIO resources until netdev removal completes Guangshuo Li
2026-11-17 14:43 ` Guangshuo Li [this message]
2026-11-17 14:45 ` [PATCH net 2/2] net: emaclite: Fix potential use-after-free during removal Guangshuo Li
2026-11-17 14:47 ` [PATCH net 0/2] net: Keep MDIO resources until netdev removal completes netdev-bot+sinfo
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=20261117-571e631490-net-1@mail.sdu.edu.cn \
--to=liguangshuo@mail.sdu.edu.cn \
--cc=andrew+netdev@lunn.ch \
--cc=boon.khai.ng@altera.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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®