syzbot


possible deadlock in mgmt_set_connectable_complete

Status: upstream: reported syz repro on 2024/05/19 04:14
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+b1752fcfa8658bb8984a@syzkaller.appspotmail.com
First crash: 190d, last: 1h00m
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly bluetooth report (Nov 2024) 0 (1) 2024/11/15 14:41
[syzbot] [bluetooth?] possible deadlock in mgmt_set_connectable_complete 0 (2) 2024/10/25 14:39

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.12.0-rc4-syzkaller-00161-gae90f6a6170d #0 Not tainted
--------------------------------------------
syz.4.19/5588 is trying to acquire lock:
ffff888058a28078 (&hdev->lock){+.+.}-{3:3}, at: mgmt_set_connectable_complete+0xaf/0x500 net/bluetooth/mgmt.c:1690

but task is already holding lock:
ffff888058a28078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x5c8/0x11c0 net/bluetooth/hci_sync.c:5189

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

       CPU0
       ----
  lock(&hdev->lock);
  lock(&hdev->lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by syz.4.19/5588:
 #0: ffff888058a28d80 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close net/bluetooth/hci_core.c:481 [inline]
 #0: ffff888058a28d80 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_close+0x10a/0x210 net/bluetooth/hci_core.c:508
 #1: ffff888058a28078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x5c8/0x11c0 net/bluetooth/hci_sync.c:5189
 #2: ffff888058a28690 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_dequeue+0x44/0x3d0 net/bluetooth/hci_sync.c:883

stack backtrace:
CPU: 0 UID: 0 PID: 5588 Comm: syz.4.19 Not tainted 6.12.0-rc4-syzkaller-00161-gae90f6a6170d #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+0x241/0x360 lib/dump_stack.c:120
 print_deadlock_bug+0x483/0x620 kernel/locking/lockdep.c:3037
 check_deadlock kernel/locking/lockdep.c:3089 [inline]
 validate_chain+0x15e2/0x5920 kernel/locking/lockdep.c:3891
 __lock_acquire+0x1384/0x2050 kernel/locking/lockdep.c:5202
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5825
 __mutex_lock_common kernel/locking/mutex.c:608 [inline]
 __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
 mgmt_set_connectable_complete+0xaf/0x500 net/bluetooth/mgmt.c:1690
 _hci_cmd_sync_cancel_entry net/bluetooth/hci_sync.c:641 [inline]
 hci_cmd_sync_dequeue+0x22b/0x3d0 net/bluetooth/hci_sync.c:886
 cmd_complete_rsp+0x4c/0x180 net/bluetooth/mgmt.c:1461
 mgmt_pending_foreach+0xd1/0x130 net/bluetooth/mgmt_util.c:259
 __mgmt_power_off+0x183/0x430 net/bluetooth/mgmt.c:9474
 hci_dev_close_sync+0x6c4/0x11c0 net/bluetooth/hci_sync.c:5197
 hci_dev_do_close net/bluetooth/hci_core.c:483 [inline]
 hci_dev_close+0x112/0x210 net/bluetooth/hci_core.c:508
 sock_do_ioctl+0x158/0x460 net/socket.c:1227
 sock_ioctl+0x626/0x8e0 net/socket.c:1346
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f404e97e719
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f404e3ff038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f404eb35f80 RCX: 00007f404e97e719
RDX: 0000000000000000 RSI: 00000000400448ca RDI: 0000000000000005
RBP: 00007f404e9f132e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f404eb35f80 R15: 00007ffde86e4688
 </TASK>

Crashes (39):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/25 14:39 upstream ae90f6a6170d 2a61f980 .config console log report syz / log [disk image (non-bootable)] [vmlinux] [kernel image] [mounted in repro] ci-snapshot-upstream-root possible deadlock in mgmt_set_connectable_complete
2024/11/21 05:20 upstream 43fb83c17ba2 4b25d554 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/11/18 10:44 upstream adc218676eef cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/11/16 14:08 upstream e8bdb3c8be08 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mgmt_set_connectable_complete
2024/11/16 12:28 upstream f868cd251776 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in mgmt_set_connectable_complete
2024/11/11 02:15 upstream a9cda7c0ffed 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in mgmt_set_connectable_complete
2024/11/09 03:28 upstream 50643bbc9eb6 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/11/08 20:14 upstream 906bd684e4b1 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/11/08 05:23 upstream 906bd684e4b1 c069283c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/11/04 10:45 upstream 59b723cd2adb f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/10/29 18:47 upstream e42b1a9a2557 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/10/28 15:33 upstream 819837584309 9efb3cc7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/10/27 13:53 upstream 850925a8133c 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in mgmt_set_connectable_complete
2024/10/26 10:43 upstream 850925a8133c 65e8686b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/10/23 20:26 upstream c2ee9f594da8 15fa2979 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/10/21 15:43 upstream 42f7652d3eb5 a93682b3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/10/19 06:24 upstream 3d5ad2d4eca3 cd6fc0a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in mgmt_set_connectable_complete
2024/10/14 22:35 upstream eca631b8fe80 b01b6661 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/10/14 01:36 upstream ba01565ced22 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in mgmt_set_connectable_complete
2024/05/15 04:12 upstream 1b10b390d945 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/11/04 10:49 upstream 59b723cd2adb f00eed24 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in mgmt_set_connectable_complete
2024/10/30 18:35 upstream c1e939a21eb1 f3a00767 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in mgmt_set_connectable_complete
2024/10/29 20:20 upstream e42b1a9a2557 66aeb999 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in mgmt_set_connectable_complete
2024/10/25 13:57 upstream ae90f6a6170d 2a61f980 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in mgmt_set_connectable_complete
2024/10/23 22:34 upstream c2ee9f594da8 15fa2979 .config console log report [disk image (non-bootable)] [vmlinux] [kernel image] ci-snapshot-upstream-root possible deadlock in mgmt_set_connectable_complete
2024/10/16 10:09 upstream 2f87d0916ce0 bde2d81c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in mgmt_set_connectable_complete
2024/10/13 06:53 upstream 7234e2ea0edd 084d8178 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in mgmt_set_connectable_complete
2024/11/18 20:20 upstream adc218676eef e7bb5d6e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in mgmt_set_connectable_complete
2024/11/09 00:26 upstream f1dce1f09380 d40c056e .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in mgmt_set_connectable_complete
2024/11/09 21:41 net eb72e7fcc839 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/10/10 23:04 net a354733c738d 8fbfc0c8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/10/06 05:00 net 9234a2549cb6 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/11/20 15:45 net-next dd7207838d38 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/11/10 15:42 net-next 774ca6d3bf24 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/10/31 17:22 net-next 157a4881225b 96eb609f .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/10/08 16:41 net-next 489cee4caeba 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in mgmt_set_connectable_complete
2024/11/07 01:33 linux-next 5b913f5d7d7f df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/09/27 08:57 linux-next 92fc9636d147 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
2024/07/20 04:10 linux-next 41c196e567fb b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in mgmt_set_connectable_complete
* Struck through repros no longer work on HEAD.