syzbot


possible deadlock in mgmt_set_connectable_complete

Status: upstream: reported on 2024/05/19 04:14
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+b1752fcfa8658bb8984a@syzkaller.appspotmail.com
First crash: 154d, last: 1d10h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bluetooth?] possible deadlock in mgmt_set_connectable_complete 0 (1) 2024/05/19 04:14

Sample crash report:
Bluetooth: hci0: hardware error 0x00
============================================
WARNING: possible recursive locking detected
6.12.0-rc3-syzkaller-00013-geca631b8fe80 #0 Not tainted
--------------------------------------------
kworker/u9:3/5234 is trying to acquire lock:
ffff888068520078 (&hdev->lock){+.+.}-{3:3}, at: mgmt_set_connectable_complete+0xaf/0x500 net/bluetooth/mgmt.c:1690

but task is already holding lock:
ffff888068520078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x572/0x11a0 net/bluetooth/hci_sync.c:5183

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

5 locks held by kworker/u9:3/5234:
 #0: ffff88807038b148 ((wq_completion)hci0){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3204 [inline]
 #0: ffff88807038b148 ((wq_completion)hci0){+.+.}-{0:0}, at: process_scheduled_works+0x93b/0x1850 kernel/workqueue.c:3310
 #1: ffffc90003d37d00 ((work_completion)(&hdev->error_reset)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3205 [inline]
 #1: ffffc90003d37d00 ((work_completion)(&hdev->error_reset)){+.+.}-{0:0}, at: process_scheduled_works+0x976/0x1850 kernel/workqueue.c:3310
 #2: ffff888068520d80 (&hdev->req_lock){+.+.}-{3:3}, at: hci_dev_do_close net/bluetooth/hci_core.c:481 [inline]
 #2: ffff888068520d80 (&hdev->req_lock){+.+.}-{3:3}, at: hci_error_reset+0x124/0x3f0 net/bluetooth/hci_core.c:1016
 #3: ffff888068520078 (&hdev->lock){+.+.}-{3:3}, at: hci_dev_close_sync+0x572/0x11a0 net/bluetooth/hci_sync.c:5183
 #4: ffff888068520690 (&hdev->cmd_sync_work_lock){+.+.}-{3:3}, at: hci_cmd_sync_dequeue+0x44/0x3d0 net/bluetooth/hci_sync.c:883

stack backtrace:
CPU: 1 UID: 0 PID: 5234 Comm: kworker/u9:3 Not tainted 6.12.0-rc3-syzkaller-00013-geca631b8fe80 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: hci0 hci_error_reset
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+0x22d/0x3d0 net/bluetooth/hci_sync.c:886
 cmd_complete_rsp+0x4c/0x180 net/bluetooth/mgmt.c:1461
 mgmt_pending_foreach+0xd3/0x130 net/bluetooth/mgmt_util.c:259
 __mgmt_power_off+0x183/0x430 net/bluetooth/mgmt.c:9474
 hci_dev_close_sync+0x665/0x11a0 net/bluetooth/hci_sync.c:5191
 hci_dev_do_close net/bluetooth/hci_core.c:483 [inline]
 hci_error_reset+0x12c/0x3f0 net/bluetooth/hci_core.c:1016
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa65/0x1850 kernel/workqueue.c:3310
 worker_thread+0x870/0xd30 kernel/workqueue.c:3391
 kthread+0x2f2/0x390 kernel/kthread.c:389
 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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/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/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/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/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.