🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
6 messages
6 total messages Started by Guangshuo Li Tue, 17 Nov 2026 14:42
[PATCH net 0/2] net: Keep MDIO resources until netdev removal completes
#17926
Author: Guangshuo Li
Date: Tue, 17 Nov 2026 14:42
15 lines
8657 bytes
Unregister the Altera and Emaclite network devices while the MDIO bus
is still available to detach the PHY.

Guangshuo Li (2):
  net: altera: Fix potential use-after-free on removal
  net: emaclite: Fix potential use-after-free during removal

 drivers/net/ethernet/altera/altera_tse_main.c | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.43.0
[PATCH net 1/2] net: altera: Fix potential use-after-free on removal
#17927
Author: Guangshuo Li
Date: Tue, 17 Nov 2026 14:43
31 lines
9523 bytes
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
[PATCH net 2/2] net: emaclite: Fix potential use-after-free during removal
#17929
Author: Guangshuo Li
Date: Tue, 17 Nov 2026 14:45
42 lines
9864 bytes
xemaclite_of_remove() frees the MDIO bus before unregistering the
network device. If the interface is up, unregister_netdev() calls
xemaclite_close(), whose phy_disconnect() still accesses that bus.
This can cause a use-after-free during PHY detachment.

Unregister the network device first so that PHY detachment finishes
before the MDIO bus is unregistered and freed.

This issue was found by our static analysis tool under development.

Fixes: 27cad0084066 ("net: emaclite: Fix MDIO bus unregister bug")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 4719d40a63ba..008e3d1e2981 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1189,6 +1189,8 @@ static void xemaclite_of_remove(struct platform_device *of_dev)
 
 	struct net_local *lp = netdev_priv(ndev);
 
+	unregister_netdev(ndev);
+
 	/* Un-register the mii_bus, if configured */
 	if (lp->mii_bus) {
 		mdiobus_unregister(lp->mii_bus);
@@ -1196,8 +1198,6 @@ static void xemaclite_of_remove(struct platform_device *of_dev)
 		lp->mii_bus = NULL;
 	}
 
-	unregister_netdev(ndev);
-
 	of_node_put(lp->phy_node);
 	lp->phy_node = NULL;
 }
-- 
2.43.0
Re: [PATCH net 0/2] net: Keep MDIO resources until netdev removal completes
#17930
Author: netdev-bot+sinfo
Date: Tue, 17 Nov 2026 14:47
19 lines
8569 bytes
Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
Re: [PATCH net 1/2] net: altera: Fix potential use-after-free on removal
#18038
Author: Andrew Lunn
Date: Tue, 17 Nov 2026 18:05
11 lines
8508 bytes
> Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")

The usual question: Does this bother anybody?

If not, net-next, no Fixes:

    Andrew

---
pw-bot: cr
Re:Re: [PATCH net 1/2] net: altera: Fix potential use-after-free on removal
#19148
Author: 李广硕
Date: Thu, 19 Nov 2026 12:45
20 lines
10508 bytes

Hi Andrew,

Thanks for the review.

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-11-18 02:05:30
To:  Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
Cc:  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>,netdev@vger.kernel.org,linux-kernel@vger.kernel.org,linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net 1/2] net: altera: Fix potential use-after-free on removal>> Fixes: bbd2190ce96d ("Altera TSE: Add main and header file for Altera Ethernet Driver")
>
>The usual question: Does this bother anybody?
>
>If not, net-next, no Fixes:
>
>    Andrew
>
>---
>pw-bot: cr
>

I found this by reading the remove path. I don't have a user report
or a reproduction on Altera hardware.

Given that, would you prefer the Altera patch on its own for net-next,
without the Fixes tag? If so, I'll resend it that way.

Thanks,
Guangshuo
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads