net: macb: init workqueues before register_netdev()

register_netdev() exposes the interface to userspace which might trigger
operations like close on it. Those access the HRESP/LPI tasks and
might therefore use them uninitialised.

Fix this race by initialising both `struct work_struct` before
register_netdev().

Theoretical bugfix. The main reason for fix is to avoid future Sashiko
reports which triggers if we grow the race condition (by touching those
workqueues at open for example). The likeliness of this bug sounds
tiny, but I've not spent any time trying to reproduce it.

Cc: stable+noautosel@kernel.org # fix for an unproven driver init path race
Fixes: c5092ba315 ("net: macb: Convert tasklet API to new bottom half workqueue mechanism")
Reported-by: sashiko <sashiko@sashiko.dev>
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260918-macb-close-v1-0-05e32ce98813%40bootlin.com
Link: https://lore.kernel.org/netdev/179010942347.2160803.5970158668197373074@kernel.org/
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Link: https://patch.msgid.link/20260925-macb-netdev-register-race-v1-1-752f90ce1c39@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Théo Lebrun 2026-09-25 15:15:08 +02:00 • committed by Jakub Kicinski
commit 0ac396fbc2