syzbot


possible deadlock in cfg80211_netdev_notifier_call

Status: fixed on 2021/04/09 19:46
Subsystems: wireless
[Documentation on labels]
Reported-by: syzbot+2ae0ca9d7737ad1a62b7@syzkaller.appspotmail.com
Fix commit: 40c575d1ec71 cfg80211: fix netdev registration deadlock
First crash: 1154d, last: 1085d
Cause bisection: introduced by (bisect log) :
commit cc9327f3b085ba5be5639a5ec3ce5b08a0f14a7c
Author: Mike Rapoport <rppt@linux.ibm.com>
Date: Thu Jan 28 07:42:40 2021 +0000

  mm: introduce memfd_secret system call to create "secret" memory areas

Crash: possible deadlock in cfg80211_netdev_notifier_call (log)
Repro: syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH v2] cfg80211: fix netdev registration deadlock 1 (1) 2021/02/01 18:20
[PATCH] cfg80211: fix netdev registration deadlock 2 (2) 2021/02/01 16:56
possible deadlock in cfg80211_netdev_notifier_call 2 (3) 2021/02/01 12:49
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in cfg80211_netdev_notifier_call (2) wireless 2 1042d 1053d 20/26 fixed on 2021/11/10 00:50

Sample crash report:
============================================
WARNING: possible recursive locking detected
5.11.0-rc5-syzkaller #0 Not tainted
--------------------------------------------
syz-executor.2/11016 is trying to acquire lock:
ffff88803d1385e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5267 [inline]
ffff88803d1385e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: cfg80211_netdev_notifier_call+0x68c/0x1180 net/wireless/core.c:1404

but task is already holding lock:
ffff88803d1385e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5267 [inline]
ffff88803d1385e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_register_hw+0x1da8/0x3c70 net/mac80211/main.c:1278

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

       CPU0
       ----
  lock(&rdev->wiphy.mtx);
  lock(&rdev->wiphy.mtx);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by syz-executor.2/11016:
 #0: ffffffff8caea210 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:810
 #1: ffffffff8caea2c8 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline]
 #1: ffffffff8caea2c8 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x3e0/0x580 net/netlink/genetlink.c:798
 #2: ffffffff8ca5a488 (rtnl_mutex){+.+.}-{3:3}, at: ieee80211_register_hw+0x1d80/0x3c70 net/mac80211/main.c:1277
 #3: ffff88803d1385e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5267 [inline]
 #3: ffff88803d1385e8 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: ieee80211_register_hw+0x1da8/0x3c70 net/mac80211/main.c:1278

stack backtrace:
CPU: 0 PID: 11016 Comm: syz-executor.2 Not tainted 5.11.0-rc5-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+0x107/0x163 lib/dump_stack.c:120
 print_deadlock_bug kernel/locking/lockdep.c:2761 [inline]
 check_deadlock kernel/locking/lockdep.c:2804 [inline]
 validate_chain kernel/locking/lockdep.c:3595 [inline]
 __lock_acquire.cold+0x114/0x39e kernel/locking/lockdep.c:4832
 lock_acquire kernel/locking/lockdep.c:5442 [inline]
 lock_acquire+0x1a8/0x720 kernel/locking/lockdep.c:5407
 __mutex_lock_common kernel/locking/mutex.c:956 [inline]
 __mutex_lock+0x134/0x1110 kernel/locking/mutex.c:1103
 wiphy_lock include/net/cfg80211.h:5267 [inline]
 cfg80211_netdev_notifier_call+0x68c/0x1180 net/wireless/core.c:1404
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2040
 call_netdevice_notifiers_extack net/core/dev.c:2052 [inline]
 call_netdevice_notifiers net/core/dev.c:2066 [inline]
 unregister_netdevice_many+0x93d/0x1750 net/core/dev.c:10715
 unregister_netdevice_queue+0x2dd/0x3c0 net/core/dev.c:10649
 register_netdevice+0x10c4/0x1500 net/core/dev.c:10024
 cfg80211_register_netdevice+0x11d/0x2a0 net/wireless/core.c:1346
 ieee80211_if_add+0xfb2/0x18e0 net/mac80211/iface.c:1990
 ieee80211_register_hw+0x331a/0x3c70 net/mac80211/main.c:1285
 mac80211_hwsim_new_radio+0x20d2/0x48d0 drivers/net/wireless/mac80211_hwsim.c:3333
 hwsim_new_radio_nl+0x9a6/0x10b0 drivers/net/wireless/mac80211_hwsim.c:3894
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739
 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
 genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2345
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2399
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2432
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45e219
Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f7665872c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045e219
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000006
RBP: 000000000119c110 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119c0dc
R13: 00007ffc9f4c6c4f R14: 00007f76658739c0 R15: 000000000119c0dc

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/01/31 16:59 net-next-old 14e8e0f60088 fc9fd31e .config console log report syz ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/30 18:14 linux-next b01f250d83f6 fc9fd31e .config console log report syz ci-upstream-linux-next-kasan-gce-root possible deadlock in cfg80211_netdev_notifier_call
2021/04/08 09:06 net-old 5219d6012d46 6a81331a .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/04/07 02:42 net-old 0f6925b3e8da 6a81331a .config console log report info ci-upstream-net-this-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/04/01 23:02 net-next-old 040806343bb4 6a81331a .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/31 23:05 net-next-old 14e8e0f60088 fc9fd31e .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/31 15:05 net-next-old 14e8e0f60088 fc9fd31e .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/31 01:16 net-next-old 14e8e0f60088 fc9fd31e .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/30 09:00 net-next-old 46eb3c108fe1 fc9fd31e .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/30 04:47 net-next-old 46eb3c108fe1 fc9fd31e .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/29 12:09 net-next-old 462512824f90 6593fd32 .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/29 05:07 net-next-old 462512824f90 7df34f59 .config console log report info ci-upstream-net-kasan-gce possible deadlock in cfg80211_netdev_notifier_call
2021/01/30 16:43 linux-next b01f250d83f6 fc9fd31e .config console log report info ci-upstream-linux-next-kasan-gce-root possible deadlock in cfg80211_netdev_notifier_call
* Struck through repros no longer work on HEAD.