BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 6263, name: kworker/u9:5 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 4 locks held by kworker/u9:5/6263: #0: ffff0000ee715948 ((wq_completion)hci4#2){+.+.}-{0:0}, at: process_one_work+0x668/0x15d4 kernel/workqueue.c:3228 #1: ffff8000a01f7c20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6b4/0x15d4 kernel/workqueue.c:3228 #2: ffff0000e8628078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xc0/0x99c net/bluetooth/hci_event.c:6939 #3: ffff80008f057840 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:328 CPU: 0 PID: 6263 Comm: kworker/u9:5 Not tainted 6.9.0-rc3-syzkaller-gfec50db7033e #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 __mutex_lock_common+0xcc/0x21a0 kernel/locking/mutex.c:585 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline] hci_le_create_big_complete_evt+0x34c/0x99c net/bluetooth/hci_event.c:6964 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7228 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0x6f4/0x1098 net/bluetooth/hci_event.c:7594 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:3416 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 ============================= [ BUG: Invalid wait context ] 6.9.0-rc3-syzkaller-gfec50db7033e #0 Tainted: G W ----------------------------- kworker/u9:5/6263 is trying to lock: ffff800091d2bdc8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline] ffff800091d2bdc8 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0x34c/0x99c net/bluetooth/hci_event.c:6964 other info that might help us debug this: context-{4:4} 4 locks held by kworker/u9:5/6263: #0: ffff0000ee715948 ((wq_completion)hci4#2){+.+.}-{0:0}, at: process_one_work+0x668/0x15d4 kernel/workqueue.c:3228 #1: ffff8000a01f7c20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6b4/0x15d4 kernel/workqueue.c:3228 #2: ffff0000e8628078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xc0/0x99c net/bluetooth/hci_event.c:6939 #3: ffff80008f057840 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:328 stack backtrace: CPU: 0 PID: 6263 Comm: kworker/u9:5 Tainted: G W 6.9.0-rc3-syzkaller-gfec50db7033e #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 print_lock_invalid_wait_context kernel/locking/lockdep.c:4751 [inline] check_wait_context kernel/locking/lockdep.c:4821 [inline] __lock_acquire+0x1be4/0x763c kernel/locking/lockdep.c:5087 lock_acquire+0x248/0x73c kernel/locking/lockdep.c:5754 __mutex_lock_common+0x190/0x21a0 kernel/locking/mutex.c:608 __mutex_lock kernel/locking/mutex.c:752 [inline] mutex_lock_nested+0x2c/0x38 kernel/locking/mutex.c:804 hci_connect_cfm include/net/bluetooth/hci_core.h:2004 [inline] hci_le_create_big_complete_evt+0x34c/0x99c net/bluetooth/hci_event.c:6964 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7228 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0x6f4/0x1098 net/bluetooth/hci_event.c:7594 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:3416 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 ================================================================== BUG: KASAN: slab-use-after-free in hci_le_create_big_complete_evt+0x304/0x99c Read of size 8 at addr ffff0000d38c4000 by task kworker/u9:5/6263 CPU: 0 PID: 6263 Comm: kworker/u9:5 Tainted: G W 6.9.0-rc3-syzkaller-gfec50db7033e #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 print_address_description mm/kasan/report.c:377 [inline] print_report+0x198/0x538 mm/kasan/report.c:488 kasan_report+0xd8/0x138 mm/kasan/report.c:601 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 hci_le_create_big_complete_evt+0x304/0x99c hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7228 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0x6f4/0x1098 net/bluetooth/hci_event.c:7594 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:3416 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Allocated by task 6258: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:565 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x264/0x3f0 mm/slub.c:3997 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] hci_conn_add+0xd0/0x1098 net/bluetooth/hci_conn.c:914 hci_le_big_sync_established_evt+0x1b0/0x954 net/bluetooth/hci_event.c:7005 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7228 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0x6f4/0x1098 net/bluetooth/hci_event.c:7594 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:3416 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Freed by task 6263: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:579 poison_slab_object+0x124/0x18c mm/kasan/common.c:240 __kasan_slab_free+0x3c/0x70 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x150/0x3e8 mm/slub.c:4390 bt_link_release+0x20/0x30 net/bluetooth/hci_sysfs.c:16 device_release+0x8c/0x1ac kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x2a8/0x41c lib/kobject.c:737 put_device+0x28/0x40 drivers/base/core.c:3828 hci_conn_del_sysfs+0x7c/0x170 net/bluetooth/hci_sysfs.c:72 hci_conn_cleanup net/bluetooth/hci_conn.c:176 [inline] hci_conn_del+0x77c/0xaf0 net/bluetooth/hci_conn.c:1126 hci_le_create_big_complete_evt+0x560/0x99c net/bluetooth/hci_event.c:6966 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7228 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0x6f4/0x1098 net/bluetooth/hci_event.c:7594 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:3416 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 The buggy address belongs to the object at ffff0000d38c4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 0 bytes inside of freed 8192-byte region [ffff0000d38c4000, ffff0000d38c6000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1138c0 head: order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x5ffe00000000840(slab|head|node=0|zone=2|lastcpupid=0xfff) page_type: 0xffffffff() raw: 05ffe00000000840 ffff0000c0002280 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 head: 05ffe00000000840 ffff0000c0002280 0000000000000000 dead000000000001 head: 0000000000000000 0000000000020002 00000001ffffffff 0000000000000000 head: 05ffe00000000003 fffffdffc34e3001 fffffdffc34e3048 00000000ffffffff head: 0000000800000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d38c3f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000d38c3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff0000d38c4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000d38c4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d38c4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Unable to handle kernel paging request at virtual address dfff800000000002 KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] Mem abort info: ESR = 0x0000000096000005 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x05: level 1 translation fault Data abort info: ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [dfff800000000002] address between user and kernel address ranges Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 6263 Comm: kworker/u9:5 Tainted: G B W 6.9.0-rc3-syzkaller-gfec50db7033e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: hci4 hci_rx_work pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : memcmp lib/string.c:676 [inline] pc : bcmp+0x134/0x1c8 lib/string.c:697 lr : bacmp include/net/bluetooth/bluetooth.h:366 [inline] lr : hci_le_create_big_complete_evt+0x214/0x99c net/bluetooth/hci_event.c:6944 sp : ffff8000a01f7710 x29: ffff8000a01f7720 x28: ffff800091d2bd40 x27: 1ffff0001403eef4 x26: 0000000000000010 x25: dfff800000000000 x24: dfff800000000000 x23: ffff8000a01f77c0 x22: 0000000000000014 x21: 0000000000000014 x20: ffff8000a01f77c0 x19: 0000000000000006 x18: 1fffe000367b9996 x17: ffff80008ee7d000 x16: ffff80008ada8940 x15: ffff70001403eef8 x14: 1ffff0001403eef8 x13: 0000000000000006 x12: ffffffffffffffff x11: ffff70001403eef8 x10: 1ffff0001403eef8 x9 : 0000000000000004 x8 : 0000000000000002 x7 : 0000000000000000 x6 : ffff8000802aabc8 x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff800089fe41d0 x2 : 0000000000000006 x1 : ffff8000a01f77c0 x0 : 0000000000000014 Call trace: memcmp lib/string.c:676 [inline] bcmp+0x134/0x1c8 lib/string.c:697 bacmp include/net/bluetooth/bluetooth.h:366 [inline] hci_le_create_big_complete_evt+0x214/0x99c net/bluetooth/hci_event.c:6944 hci_le_meta_evt+0x2b8/0x47c net/bluetooth/hci_event.c:7228 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0x6f4/0x1098 net/bluetooth/hci_event.c:7594 hci_rx_work+0x318/0xa78 net/bluetooth/hci_core.c:4171 process_one_work+0x7b8/0x15d4 kernel/workqueue.c:3254 process_scheduled_works kernel/workqueue.c:3335 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:3416 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Code: aa1503f6 aa1403f7 d343fea8 12000aa9 (38f86908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: aa1503f6 mov x22, x21 4: aa1403f7 mov x23, x20 8: d343fea8 lsr x8, x21, #3 c: 12000aa9 and w9, w21, #0x7 * 10: 38f86908 ldrsb w8, [x8, x24] <-- trapping instruction