Thread (5 messages) 5 messages, 2 authors, 2026-02-03

Re: [PATCH net v4] net: cpsw_new: Execute ndo_set_rx_mode callback in a work queue

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-02-03 00:19:19
Also in: linux-omap, stable

On Sun, 1 Feb 2026 09:15:10 +0800 Kevin Hao wrote:
quoted
quoted
-		unregister_netdev(cpsw->slaves[i].ndev);
+		priv = netdev_priv(ndev);
+		disable_work_sync(&priv->rx_mode_work);
+		unregister_netdev(ndev);  
I understand that this is safe but I think that more logical ordering
would be to shut things down _after_ object is unregistered.  
I'm a bit confused—are you suggesting that we move disable_work_sync() after
unregister_netdev()? If that's the case, the scheduled cpsw_ndo_set_rx_mode_work()
could potentially run after the network device has been unregistered, leading to
a use-after-free issue. Or am I misunderstanding something here?
Unregistered device is not freed yet. The netdev is only freed after
.remove routine returns. Passing unregistered netdev to netif_running()
is safe and will return false.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help