linux/drivers/net/ethernet/microchip
Daniel Machon b62793a7ba net: sparx5: fix sleep in atomic context in MAC table access
sparx5_set_rx_mode() runs with netif_addr_lock_bh held and iterates
dev->mc via __dev_mc_sync(), which per address calls sparx5_mc_sync() /
sparx5_mc_unsync() -> sparx5_mact_learn() / sparx5_mact_forget().  These
take sparx5->lock, a mutex, and then poll the MAC access command
register with readx_poll_timeout(). A mutex may block, which is not
allowed from atomic context.

Convert the driver to the new .ndo_set_rx_mode_async callback introduced
in commit 3554b4345d ("net: introduce ndo_set_rx_mode_async and
netdev_rx_mode_work"). The async callback is invoked from process
context, so the mutex and sleeping completion poll can remain.

Observed with CONFIG_PROVE_LOCKING, CONFIG_DEBUG_SPINLOCK,
CONFIG_DEBUG_MUTEXES and CONFIG_DEBUG_ATOMIC_SLEEP enabled:

  BUG: sleeping function called from invalid context at kernel/locking/mutex.c:591
  in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 217, name: ip
  preempt_count: 201, expected: 0
  Call trace:
   __might_resched+0x144/0x248
   __might_sleep+0x48/0x7c
   __mutex_lock+0x74/0x850
   mutex_lock_nested+0x24/0x30
   sparx5_mact_learn+0x78/0x100
   sparx5_mc_sync+0x40/0x54
   __hw_addr_sync_dev+0xc4/0x170
   sparx5_set_rx_mode+0x4c/0x58
   __dev_set_rx_mode+0x64/0xa4
   __dev_open+0x1ec/0x26c

Fixes: d6fce51419 ("net: sparx5: add switching support")
Signed-off-by: Daniel Machon <daniel.machon@microchip.com>
Link: https://patch.msgid.link/20260817-misc-fixes-sparx5-lan969x-v3-2-c7c7fef723a8@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-22 13:21:26 -07:00
..
fdma net: microchip: dead code cleanup in kconfig for FDMA 2026-04-01 19:50:12 -07:00
lan865x net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag 2026-07-21 10:53:24 +02:00
lan966x net: microchip: vcap: fix races on the shared Super VCAP block 2026-07-05 09:18:47 +02:00
sparx5 net: sparx5: fix sleep in atomic context in MAC table access 2026-08-22 13:21:26 -07:00
vcap net: microchip: vcap: use port number instead of netdev name for debugfs 2026-08-22 13:21:26 -07:00
enc28j60_hw.h
enc28j60.c
encx24j600_hw.h net: encx24j600: Correct spelling in comments 2024-04-25 19:13:26 -07:00
encx24j600-regmap.c net: encx24j600: constify struct regmap_bus/regmap_config 2024-07-05 17:02:20 -07:00
encx24j600.c net: encx24j600: Correct spelling in comments 2024-04-25 19:13:26 -07:00
Kconfig net: lan969x: fix cyclic dependency reported by depmod 2024-12-09 13:30:16 +00:00
lan743x_ethtool.c net: microchip: lan743x: add ethtool nway_reset support 2026-02-24 15:10:56 +01:00
lan743x_ethtool.h
lan743x_main.c net: lan743x: add support for RMII interface 2026-07-30 10:19:29 +02:00
lan743x_main.h net: lan743x: add support for RMII interface 2026-07-30 10:19:29 +02:00
lan743x_ptp.c net: lan743x: implement ndo_hwtstamp_get() 2025-05-15 17:56:38 -07:00
lan743x_ptp.h net: lan743x: fix potential out-of-bounds write in lan743x_ptp_io_event_clock_get() 2025-06-19 15:32:14 +02:00
Makefile net: lan969x: fix cyclic dependency reported by depmod 2024-12-09 13:30:16 +00:00