linux/drivers/net/dsa/mxl862xx
Daniel Golle 9e92ad4630 net: dsa: mxl862xx: disable the stats poll on teardown
mxl862xx_setup() arms the stats poll before mxl862xx_setup_mdio(), and
nothing stops it until dsa_register_switch() has returned an error to
mxl862xx_probe(). DSA frees the dsa_port list before it returns, so a
poll that fires once .setup or a later step of dsa_tree_setup() has
failed walks freed ports. On shutdown the user ports stay registered,
and the WORK_STOPPED flag test in mxl862xx_get_stats64() is not atomic
with the cancel in mxl862xx_shutdown(), so a re-arm that read the flag
before it was set queues the poll after cancel_delayed_work_sync() has
returned.

Arm the poll once .setup has succeeded and stop it from a .teardown op,
which DSA calls on unregister and after a failed registration, in both
cases before it frees the ports. Use disable_delayed_work_sync() there
and in shutdown(): it drains a running poll as the cancel did and turns
every later attempt to queue the work into a no-op, so the re-arm
cannot bring the poll back. remove() and the probe error path only set
WORK_STOPPED, which crc_err_work tests before it walks the ports.

Fixes: a21d33a526 ("net: dsa: mxl862xx: implement .get_stats64")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Link: https://patch.msgid.link/1eb6f7fc1789b67e4b11e3f4d5ff080d0b6f7cbb.1789045590.git.daniel@makrotopia.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-14 19:05:46 -07:00
..
Kconfig net: dsa: mxl862xx: add CRC for MDIO communication 2026-03-24 20:47:21 -07:00
Makefile net: dsa: mxl862xx: move phylink stubs to mxl862xx-phylink.c 2026-06-15 17:18:00 -07:00
mxl862xx-api.h net: dsa: mxl862xx: add support for SerDes ports 2026-06-15 17:18:01 -07:00
mxl862xx-cmd.h net: dsa: mxl862xx: add support for SerDes ports 2026-06-15 17:18:01 -07:00
mxl862xx-host.c net: dsa: mxl862xx: fix use-after-free of DSA ports in crc_err_work 2026-06-24 17:51:11 -07:00
mxl862xx-host.h net: dsa: mxl862xx: move API macros to mxl862xx-host.h 2026-06-15 17:18:01 -07:00
mxl862xx-phylink.c net: dsa: mxl862xx: add support for SerDes ports 2026-06-15 17:18:01 -07:00
mxl862xx-phylink.h net: dsa: mxl862xx: add support for SerDes ports 2026-06-15 17:18:01 -07:00
mxl862xx.c net: dsa: mxl862xx: disable the stats poll on teardown 2026-09-14 19:05:46 -07:00
mxl862xx.h net: dsa: mxl862xx: add support for SerDes ports 2026-06-15 17:18:01 -07:00