possible deadlock in cfg80211_netdev_notifier_call (2)

Status: fixed on 2021/11/10 00:50
Subsystems: wireless
[Documentation on labels]
Fix commit: d5befb224edb mac80211: fix deadlock in AP/VLAN handling
First crash: 945d, last: 933d
Discussions (3)
Title Replies (including bot) Last reply
[PATCH 5.12 000/178] 5.12.13-rc1 review 185 (185) 2021/06/23 15:12
[PATCH] mac80211: fix deadlock in AP/VLAN handling 1 (1) 2021/05/17 14:03
[syzbot] possible deadlock in cfg80211_netdev_notifier_call (2) 0 (1) 2021/05/10 12:20
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in cfg80211_netdev_notifier_call wireless syz done 13 976d 1042d 22/25 fixed on 2021/04/09 19:46

Sample crash report:
WARNING: possible recursive locking detected
5.12.0-syzkaller #0 Not tainted
syz-executor.1/16085 is trying to acquire lock:
ffff88804f3b05e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5273 [inline]
ffff88804f3b05e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: cfg80211_netdev_notifier_call+0x704/0x11d0 net/wireless/core.c:1429

but task is already holding lock:
ffff88804f3b05e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5273 [inline]
ffff88804f3b05e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0x6a/0xf0 net/mac80211/iface.c:644

other info that might help us debug this:
 Possible unsafe locking scenario:


 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz-executor.1/16085:
 #0: ffffffff8d6a4968 (rtnl_mutex){+.+.}-{3:3}, at: dev_ioctl+0x19f/0xb70 net/core/dev_ioctl.c:504
 #1: ffff88804f3b05e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5273 [inline]
 #1: ffff88804f3b05e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_stop+0x6a/0xf0 net/mac80211/iface.c:644

stack backtrace:
CPU: 0 PID: 16085 Comm: syz-executor.1 Not tainted 5.12.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_deadlock_bug kernel/locking/lockdep.c:2831 [inline]
 check_deadlock kernel/locking/lockdep.c:2874 [inline]
 validate_chain kernel/locking/lockdep.c:3663 [inline]
 __lock_acquire.cold+0x22f/0x3b4 kernel/locking/lockdep.c:4902
 lock_acquire kernel/locking/lockdep.c:5512 [inline]
 lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477
 __mutex_lock_common kernel/locking/mutex.c:949 [inline]
 __mutex_lock+0x139/0x1120 kernel/locking/mutex.c:1096
 wiphy_lock include/net/cfg80211.h:5273 [inline]
 cfg80211_netdev_notifier_call+0x704/0x11d0 net/wireless/core.c:1429
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2121
 call_netdevice_notifiers_extack net/core/dev.c:2133 [inline]
 call_netdevice_notifiers net/core/dev.c:2147 [inline]
 __dev_close_many+0xf3/0x2f0 net/core/dev.c:1667
 dev_close_many+0x22c/0x620 net/core/dev.c:1718
 dev_close net/core/dev.c:1744 [inline]
 dev_close+0x16d/0x210 net/core/dev.c:1738
 ieee80211_do_stop+0x1276/0x20e0 net/mac80211/iface.c:486
 ieee80211_stop+0x77/0xf0 net/mac80211/iface.c:645
 __dev_close_many+0x1b8/0x2f0 net/core/dev.c:1693
 __dev_close net/core/dev.c:1705 [inline]
 __dev_change_flags+0x2ca/0x750 net/core/dev.c:8739
 dev_change_flags+0x93/0x170 net/core/dev.c:8812
 dev_ifsioc+0x210/0xa60 net/core/dev_ioctl.c:254
 dev_ioctl+0x1ad/0xb70 net/core/dev_ioctl.c:505
 sock_do_ioctl+0x148/0x2d0 net/socket.c:1062
 sock_ioctl+0x477/0x6a0 net/socket.c:1179
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:1069 [inline]
 __se_sys_ioctl fs/ioctl.c:1055 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
RIP: 0033:0x4665f9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f59aeea3188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 00000000004665f9
RDX: 00000000200005c0 RSI: 0000000000008914 RDI: 0000000000000003
RBP: 00000000004bfce1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
R13: 0000000000a9fb1f R14: 00007f59aeea3300 R15: 0000000000022000

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/05/09 11:07 upstream b741596468b0 bc5434be .config console log report info ci-upstream-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/05/21 17:24 net-old 5cb4a593821f 3c7fef33 .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
* Struck through repros no longer work on HEAD.