]> www.infradead.org Git - users/hch/misc.git/commit
net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 10 Mar 2025 12:31:25 +0000 (12:31 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Mon, 17 Mar 2025 20:36:20 +0000 (21:36 +0100)
commit180fa8d0a2cb4c1b0f60cc28ce481407c3c44ffb
treebf6d72a8db6f2be2cd1109812a2855af04a64637
parent35b862eac9099bb492229627c44e541633fb5938
net: stmmac: remove redundant racy tear-down in stmmac_dvr_remove()

While the network device is registered, it is published to userspace,
and thus userspace can change its state. This means calling
functions such as stmmac_stop_all_dma() and stmmac_mac_set() are
racy.

Moreover, unregister_netdev() will unpublish the network device, and
then if appropriate call the .ndo_stop() method, which is
stmmac_release(). This will first call phylink_stop() which will
synchronously take the link down, resulting in stmmac_mac_link_down()
and stmmac_mac_set(, false) being called.

stmmac_release() will also call stmmac_stop_all_dma().

Consequently, neither of these two functions need to called prior
to unregister_netdev() as that will safely call paths that will
result in this work being done if necessary.

Remove these redundant racy calls.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Furong Xu <0x1207@gmail.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1trcI1-005rn2-CZ@rmk-PC.armlinux.org.uk
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c