syzbot


BUG: sleeping function called from invalid context in lock_sock_nested (3)

Status: upstream: reported on 2024/05/13 12:58
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+55cd5225f71c5cff7f6f@syzkaller.appspotmail.com
First crash: 23d, last: 11d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [bluetooth?] BUG: sleeping function called from invalid context in lock_sock_nested (3) 1 (2) 2024/05/13 23:26
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 BUG: sleeping function called from invalid context in lock_sock_nested (2) C done 3909 994d 1087d 1/1 fixed on 2021/10/12 13:38
upstream BUG: sleeping function called from invalid context in lock_sock_nested (2) bluetooth C done error 19391 1025d 1561d 20/26 fixed on 2021/11/10 13:22
linux-4.14 BUG: sleeping function called from invalid context in lock_sock_nested 1 1796d 1796d 0/1 auto-closed as invalid on 2019/10/30 11:24
linux-4.14 BUG: sleeping function called from invalid context in lock_sock_nested (2) syz done 1 1580d 1640d 1/1 fixed on 2020/03/04 10:17
linux-4.19 BUG: sleeping function called from invalid context in lock_sock_nested syz done 1 1610d 1640d 1/1 fixed on 2020/02/05 13:33
upstream BUG: sleeping function called from invalid context in lock_sock_nested bpf net C 1232 1565d 1640d 15/26 fixed on 2020/02/18 14:31
linux-4.14 BUG: sleeping function called from invalid context in lock_sock_nested (3) syz error 144 581d 1086d 0/1 upstream: reported syz repro on 2021/06/10 20:33

Sample crash report:
BUG: sleeping function called from invalid context at net/core/sock.c:3537
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 6265, name: kworker/u9:2
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
6 locks held by kworker/u9:2/6265:
 #0: ffff0000dcd47948 ((wq_completion)hci4#2){+.+.}-{0:0}, at: process_one_work+0x668/0x15d4 kernel/workqueue.c:3241
 #1: ffff800097c07c20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6b4/0x15d4 kernel/workqueue.c:3241
 #2: ffff0000eafcc078 (&hdev->lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0xa4/0x870 net/bluetooth/hci_event.c:5061
 #3: ffff800091d61788 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:2010 [inline]
 #3: ffff800091d61788 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x3d4/0x870 net/bluetooth/hci_event.c:5144
 #4: ffff0000ef2adc20 (&conn->lock#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #4: ffff0000ef2adc20 (&conn->lock#2){+.+.}-{2:2}, at: sco_conn_ready net/bluetooth/sco.c:1273 [inline]
 #4: ffff0000ef2adc20 (&conn->lock#2){+.+.}-{2:2}, at: sco_connect_cfm+0x260/0x94c net/bluetooth/sco.c:1358
 #5: ffff0000ec9f4258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1673 [inline]
 #5: ffff0000ec9f4258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1286 [inline]
 #5: ffff0000ec9f4258 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1358
Preemption disabled at:
[<ffff80008a0d70d4>] spin_lock include/linux/spinlock.h:351 [inline]
[<ffff80008a0d70d4>] sco_conn_ready net/bluetooth/sco.c:1273 [inline]
[<ffff80008a0d70d4>] sco_connect_cfm+0x260/0x94c net/bluetooth/sco.c:1358
CPU: 0 PID: 6265 Comm: kworker/u9:2 Not tainted 6.9.0-rc7-syzkaller-gfda5695d692c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: hci4 hci_rx_work
Call trace:
 dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:317
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:114
 dump_stack+0x1c/0x28 lib/dump_stack.c:123
 __might_resched+0x374/0x4d0 kernel/sched/core.c:10197
 __might_sleep+0x90/0xe4 kernel/sched/core.c:10126
 lock_sock_nested+0x6c/0x11c net/core/sock.c:3537
 lock_sock include/net/sock.h:1673 [inline]
 sco_conn_ready net/bluetooth/sco.c:1286 [inline]
 sco_connect_cfm+0x3e8/0x94c net/bluetooth/sco.c:1358
 hci_connect_cfm include/net/bluetooth/hci_core.h:2013 [inline]
 hci_sync_conn_complete_evt+0x438/0x870 net/bluetooth/hci_event.c:5144
 hci_event_func net/bluetooth/hci_event.c:7545 [inline]
 hci_event_packet+0x740/0x1098 net/bluetooth/hci_event.c:7597
 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171
 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3267
 process_scheduled_works kernel/workqueue.c:3348 [inline]
 worker_thread+0x938/0xef4 kernel/workqueue.c:3429
 kthread+0x288/0x310 kernel/kthread.c:388
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
Bluetooth: hci4: command 0x0406 tx timeout

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/21 05:01 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci fda5695d692c c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in lock_sock_nested
2024/05/09 12:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 1c9135d29e9e 20bf80e1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 BUG: sleeping function called from invalid context in lock_sock_nested
* Struck through repros no longer work on HEAD.