syzbot


possible deadlock in cfg80211_netdev_notifier_call (3)

Status: upstream: reported on 2024/06/16 17:50
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+61f0f147bbf185cfa088@syzkaller.appspotmail.com
First crash: 241d, last: 6d15h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [wireless?] possible deadlock in cfg80211_netdev_notifier_call (3) 0 (1) 2024/06/16 17:50
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in cfg80211_netdev_notifier_call (2) wireless 2 1359d 1370d 20/28 fixed on 2021/11/10 00:50
upstream possible deadlock in cfg80211_netdev_notifier_call wireless syz done 13 1403d 1469d 20/28 fixed on 2021/04/09 19:46

Sample crash report:
netlink: 'syz.5.6554': attribute type 10 has an invalid length.
netlink: 55 bytes leftover after parsing attributes in process `syz.5.6554'.
======================================================
WARNING: possible circular locking dependency detected
6.13.0-syzkaller-09760-g69e858e0b8b2 #0 Not tainted
------------------------------------------------------
syz.5.6554/30353 is trying to acquire lock:
ffff888045210768 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: wiphy_lock include/net/cfg80211.h:6046 [inline]
ffff888045210768 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: cfg80211_netdev_notifier_call+0x371/0x1160 net/wireless/core.c:1569

but task is already holding lock:
ffff88805c534e00 (team->team_lock_key#15){+.+.}-{4:4}, at: team_add_slave+0x9c/0x2080 drivers/net/team/team_core.c:1987

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (team->team_lock_key#15){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730
       team_set_mac_address+0x17f/0x290 drivers/net/team/team_core.c:1816
       dev_set_mac_address+0x301/0x4a0 net/core/dev.c:9430
       dev_set_mac_address_user+0x30/0x50 net/core/dev.c:9449
       do_setlink.constprop.0+0x65a/0x3f20 net/core/rtnetlink.c:3073
       rtnl_changelink net/core/rtnetlink.c:3732 [inline]
       __rtnl_newlink net/core/rtnetlink.c:3884 [inline]
       rtnl_newlink+0x131c/0x1d70 net/core/rtnetlink.c:4021
       rtnetlink_rcv_msg+0x95b/0xea0 net/core/rtnetlink.c:6911
       netlink_rcv_skb+0x165/0x410 net/netlink/af_netlink.c:2543
       netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
       netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1348
       netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1892
       sock_sendmsg_nosec net/socket.c:713 [inline]
       __sock_sendmsg net/socket.c:728 [inline]
       __sys_sendto+0x488/0x4f0 net/socket.c:2182
       __do_compat_sys_socketcall+0x5e2/0x700 net/compat.c:475
       do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
       __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
       do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
       entry_SYSENTER_compat_after_hwframe+0x84/0x8e

-> #2 (dev_addr_sem){++++}-{4:4}:
       down_read+0x9a/0x330 kernel/locking/rwsem.c:1524
       address_show+0x23/0x2a0 net/core/net-sysfs.c:184
       dev_attr_show+0x53/0xe0 drivers/base/core.c:2423
       sysfs_kf_seq_show+0x223/0x3e0 fs/sysfs/file.c:59
       seq_read_iter+0x4f4/0x12b0 fs/seq_file.c:230
       kernfs_fop_read_iter+0x414/0x580 fs/kernfs/file.c:279
       new_sync_read fs/read_write.c:484 [inline]
       vfs_read+0x886/0xbf0 fs/read_write.c:565
       ksys_read+0x12b/0x250 fs/read_write.c:708
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (kn->active#21){++++}-{0:0}:
       kernfs_drain+0x48f/0x590 fs/kernfs/dir.c:500
       __kernfs_remove+0x281/0x670 fs/kernfs/dir.c:1487
       kernfs_remove_by_name_ns+0xb2/0x130 fs/kernfs/dir.c:1695
       kernfs_remove_by_name include/linux/kernfs.h:625 [inline]
       remove_files+0x96/0x1c0 fs/sysfs/group.c:28
       sysfs_remove_group+0x8b/0x180 fs/sysfs/group.c:322
       sysfs_remove_groups fs/sysfs/group.c:346 [inline]
       sysfs_remove_groups+0x60/0xa0 fs/sysfs/group.c:338
       device_remove_groups drivers/base/core.c:2819 [inline]
       device_remove_attrs+0x204/0x290 drivers/base/core.c:2955
       device_del+0x38e/0x9f0 drivers/base/core.c:3853
       unregister_netdevice_many_notify+0x13aa/0x1f30 net/core/dev.c:11824
       unregister_netdevice_many net/core/dev.c:11852 [inline]
       unregister_netdevice_queue+0x307/0x3f0 net/core/dev.c:11722
       unregister_netdevice include/linux/netdevice.h:3329 [inline]
       _cfg80211_unregister_wdev+0x64b/0x830 net/wireless/core.c:1248
       ieee80211_remove_interfaces+0x34f/0x720 net/mac80211/iface.c:2305
       ieee80211_unregister_hw+0x55/0x3a0 net/mac80211/main.c:1681
       mac80211_hwsim_del_radio+0x268/0x370 drivers/net/wireless/virtual/mac80211_hwsim.c:5664
       remove_user_radios drivers/net/wireless/virtual/mac80211_hwsim.c:6464 [inline]
       mac80211_hwsim_netlink_notify+0x27b/0x7d0 drivers/net/wireless/virtual/mac80211_hwsim.c:6478
       notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
       blocking_notifier_call_chain kernel/notifier.c:380 [inline]
       blocking_notifier_call_chain+0x69/0xa0 kernel/notifier.c:368
       netlink_release+0x195e/0x2130 net/netlink/af_netlink.c:764
       __sock_release+0xb0/0x270 net/socket.c:642
       sock_close+0x1c/0x30 net/socket.c:1393
       __fput+0x3ff/0xb70 fs/file_table.c:450
       __fput_sync+0xa1/0xc0 fs/file_table.c:536
       __do_sys_close fs/open.c:1579 [inline]
       __se_sys_close fs/open.c:1564 [inline]
       __ia32_sys_close+0x86/0x100 fs/open.c:1564
       do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
       __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
       do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
       entry_SYSENTER_compat_after_hwframe+0x84/0x8e

-> #0 (&rdev->wiphy.mtx){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3163 [inline]
       check_prevs_add kernel/locking/lockdep.c:3282 [inline]
       validate_chain kernel/locking/lockdep.c:3906 [inline]
       __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5228
       lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5851
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730
       wiphy_lock include/net/cfg80211.h:6046 [inline]
       cfg80211_netdev_notifier_call+0x371/0x1160 net/wireless/core.c:1569
       notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
       call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:2141
       call_netdevice_notifiers_extack net/core/dev.c:2179 [inline]
       call_netdevice_notifiers net/core/dev.c:2193 [inline]
       dev_open net/core/dev.c:1645 [inline]
       dev_open+0x144/0x160 net/core/dev.c:1633
       team_port_add drivers/net/team/team_core.c:1229 [inline]
       team_add_slave+0xab5/0x2080 drivers/net/team/team_core.c:1988
       do_set_master+0x1bc/0x230 net/core/rtnetlink.c:2926
       do_setlink.constprop.0+0xa0d/0x3f20 net/core/rtnetlink.c:3125
       rtnl_changelink net/core/rtnetlink.c:3732 [inline]
       __rtnl_newlink net/core/rtnetlink.c:3884 [inline]
       rtnl_newlink+0x131c/0x1d70 net/core/rtnetlink.c:4021
       rtnetlink_rcv_msg+0x95b/0xea0 net/core/rtnetlink.c:6911
       netlink_rcv_skb+0x165/0x410 net/netlink/af_netlink.c:2543
       netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
       netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1348
       netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1892
       sock_sendmsg_nosec net/socket.c:713 [inline]
       __sock_sendmsg net/socket.c:728 [inline]
       ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2568
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2622
       __sys_sendmsg+0x16e/0x220 net/socket.c:2654
       do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
       __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
       do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
       entry_SYSENTER_compat_after_hwframe+0x84/0x8e

other info that might help us debug this:

Chain exists of:
  &rdev->wiphy.mtx --> dev_addr_sem --> team->team_lock_key#15

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(team->team_lock_key#15);
                               lock(dev_addr_sem);
                               lock(team->team_lock_key#15);
  lock(&rdev->wiphy.mtx);

 *** DEADLOCK ***

2 locks held by syz.5.6554/30353:
 #0: ffffffff8fed6be8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock net/core/rtnetlink.c:79 [inline]
 #0: ffffffff8fed6be8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_nets_lock net/core/rtnetlink.c:335 [inline]
 #0: ffffffff8fed6be8 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_newlink+0x5e4/0x1d70 net/core/rtnetlink.c:4020
 #1: ffff88805c534e00 (team->team_lock_key#15){+.+.}-{4:4}, at: team_add_slave+0x9c/0x2080 drivers/net/team/team_core.c:1987

stack backtrace:
CPU: 1 UID: 0 PID: 30353 Comm: syz.5.6554 Not tainted 6.13.0-syzkaller-09760-g69e858e0b8b2 #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_circular_bug+0x490/0x760 kernel/locking/lockdep.c:2076
 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2208
 check_prev_add kernel/locking/lockdep.c:3163 [inline]
 check_prevs_add kernel/locking/lockdep.c:3282 [inline]
 validate_chain kernel/locking/lockdep.c:3906 [inline]
 __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5228
 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5851
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0x19b/0xb10 kernel/locking/mutex.c:730
 wiphy_lock include/net/cfg80211.h:6046 [inline]
 cfg80211_netdev_notifier_call+0x371/0x1160 net/wireless/core.c:1569
 notifier_call_chain+0xb7/0x410 kernel/notifier.c:85
 call_netdevice_notifiers_info+0xbe/0x140 net/core/dev.c:2141
 call_netdevice_notifiers_extack net/core/dev.c:2179 [inline]
 call_netdevice_notifiers net/core/dev.c:2193 [inline]
 dev_open net/core/dev.c:1645 [inline]
 dev_open+0x144/0x160 net/core/dev.c:1633
 team_port_add drivers/net/team/team_core.c:1229 [inline]
 team_add_slave+0xab5/0x2080 drivers/net/team/team_core.c:1988
 do_set_master+0x1bc/0x230 net/core/rtnetlink.c:2926
 do_setlink.constprop.0+0xa0d/0x3f20 net/core/rtnetlink.c:3125
 rtnl_changelink net/core/rtnetlink.c:3732 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3884 [inline]
 rtnl_newlink+0x131c/0x1d70 net/core/rtnetlink.c:4021
 rtnetlink_rcv_msg+0x95b/0xea0 net/core/rtnetlink.c:6911
 netlink_rcv_skb+0x165/0x410 net/netlink/af_netlink.c:2543
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1892
 sock_sendmsg_nosec net/socket.c:713 [inline]
 __sock_sendmsg net/socket.c:728 [inline]
 ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2568
 ___sys_sendmsg+0x135/0x1e0 net/socket.c:2622
 __sys_sendmsg+0x16e/0x220 net/socket.c:2654
 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline]
 __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386
 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411
 entry_SYSENTER_compat_after_hwframe+0x84/0x8e
RIP: 0023:0xf73de579
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00
RSP: 002b:00000000f506655c EFLAGS: 00000296 ORIG_RAX: 0000000000000172
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 0000000020000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>
team0: Port device virt_wifi0 added
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	10 06                	adc    %al,(%rsi)
   2:	03 74 b4 01          	add    0x1(%rsp,%rsi,4),%esi
   6:	10 07                	adc    %al,(%rdi)
   8:	03 74 b0 01          	add    0x1(%rax,%rsi,4),%esi
   c:	10 08                	adc    %cl,(%rax)
   e:	03 74 d8 01          	add    0x1(%rax,%rbx,8),%esi
  1e:	00 51 52             	add    %dl,0x52(%rcx)
  21:	55                   	push   %rbp
  22:	89 e5                	mov    %esp,%ebp
  24:	0f 34                	sysenter
  26:	cd 80                	int    $0x80
* 28:	5d                   	pop    %rbp <-- trapping instruction
  29:	5a                   	pop    %rdx
  2a:	59                   	pop    %rcx
  2b:	c3                   	ret
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop
  30:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi
  37:	8d b4 26 00 00 00 00 	lea    0x0(%rsi,%riz,1),%esi

Crashes (10):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/02/02 18:30 upstream 69e858e0b8b2 568559e4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in cfg80211_netdev_notifier_call
2024/07/04 10:28 net 9a0c28efeec6 409d975c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/10/28 17:37 net-next 6d858708d465 9efb3cc7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/09/10 03:18 net-next bfba7bc8b7c2 dd9c7e97 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/08/08 22:40 net-next 91d516d4de48 61405512 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/08/08 07:54 net-next e66f33bdf0c3 de12cf65 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/08/02 04:17 net-next 743ff02152bc 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/07/02 09:39 net-next 74d6529b78f7 b294e901 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/06/29 14:01 net-next 30972a4ea092 757f06b1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2024/06/12 17:47 net-next 45403b12c29c 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
* Struck through repros no longer work on HEAD.