mirror-linux/drivers/net
Horatiu Vultur 0216721ce7 lan966x: Fix sleeping in atomic context
The following warning was seen when we try to connect using ssh to the device.

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:575
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 104, name: dropbear
preempt_count: 1, expected: 0
INFO: lockdep is turned off.
CPU: 0 UID: 0 PID: 104 Comm: dropbear Tainted: G        W           6.18.0-rc2-00399-g6f1ab1b109b9-dirty #530 NONE
Tainted: [W]=WARN
Hardware name: Generic DT based system
Call trace:
 unwind_backtrace from show_stack+0x10/0x14
 show_stack from dump_stack_lvl+0x7c/0xac
 dump_stack_lvl from __might_resched+0x16c/0x2b0
 __might_resched from __mutex_lock+0x64/0xd34
 __mutex_lock from mutex_lock_nested+0x1c/0x24
 mutex_lock_nested from lan966x_stats_get+0x5c/0x558
 lan966x_stats_get from dev_get_stats+0x40/0x43c
 dev_get_stats from dev_seq_printf_stats+0x3c/0x184
 dev_seq_printf_stats from dev_seq_show+0x10/0x30
 dev_seq_show from seq_read_iter+0x350/0x4ec
 seq_read_iter from seq_read+0xfc/0x194
 seq_read from proc_reg_read+0xac/0x100
 proc_reg_read from vfs_read+0xb0/0x2b0
 vfs_read from ksys_read+0x6c/0xec
 ksys_read from ret_fast_syscall+0x0/0x1c
Exception stack(0xf0b11fa8 to 0xf0b11ff0)
1fa0:                   00000001 00001000 00000008 be9048d8 00001000 00000001
1fc0: 00000001 00001000 00000008 00000003 be905920 0000001e 00000000 00000001
1fe0: 0005404c be9048c0 00018684 b6ec2cd8

It seems that we are using a mutex in a atomic context which is wrong.
Change the mutex with a spinlock.

Fixes: 12c2d0a5b8 ("net: lan966x: add ethtool configuration and statistics")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20251105074955.1766792-1-horatiu.vultur@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-11-06 07:31:34 -08:00
..
arcnet
bonding bonding: fix NULL pointer dereference in actor_port_prio setting 2025-11-06 07:16:37 -08:00
caif
can can: netlink: can_changelink(): allow disabling of automatic restart 2025-10-20 17:20:12 +02:00
dsa net: dsa: microchip: Fix reserved multicast address table programming 2025-11-06 07:11:36 -08:00
ethernet lan966x: Fix sleeping in atomic context 2025-11-06 07:31:34 -08:00
fddi
fjes
hamradio 6pack: drop redundant locking and refcounting 2025-09-30 10:10:59 +02:00
hippi
hyperv hyperv-next for v6.18 2025-10-07 08:40:15 -07:00
ieee802154
ipa
ipvlan
mctp net: mctp: Fix tx queue stall 2025-10-29 17:55:14 -07:00
mdio net: mdio: Check regmap pointer returned by device_node_to_regmap() 2025-11-03 16:20:03 -08:00
netdevsim netdevsim: set the carrier when the device goes up 2025-10-15 17:43:17 -07:00
ovpn ovpn: use datagram_poll_queue for socket readiness in TCP 2025-10-23 15:46:04 +02:00
pcs
phy net: phy: micrel: lan8842 errata 2025-11-03 16:48:44 -08:00
plip
ppp
pse-pd net: pse-pd: tps23881: Fix current measurement scaling 2025-10-07 18:30:53 -07:00
slip
team
thunderbolt
usb net: usb: qmi_wwan: initialize MAC header offset in qmimux_rx_fixup 2025-11-03 17:36:49 -08:00
vmxnet3
vxlan
wan net: wan: framer: pef2256: Switch to devm_mfd_add_devices() 2025-11-05 18:02:34 -08:00
wireguard
wireless ath.git update for v6.18-rc5 2025-11-05 16:18:48 +01:00
wwan net: wwan: t7xx: add support for HP DRMR-H01 2025-10-06 11:10:38 -07:00
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
loopback.c
macsec.c
macvlan.c
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c netconsole: Acquire su_mutex before navigating configs hierarchy 2025-10-31 17:45:06 -07:00
netkit.c
nlmon.c
ntb_netdev.c
pfcp.c
rionet.c
sungem_phy.c
tap.c
tun.c
tun_vnet.h
veth.c
virtio_net.c virtio-net: fix received length check in big packets 2025-11-04 18:49:29 -08:00
vrf.c
vsockmon.c
xen-netfront.c