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.