BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 5995, name: kworker/u9:1 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 4 locks held by kworker/u9:1/5995: #0: ffff0000d5128148 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x628/0x1600 kernel/workqueue.c:3203 #1: ffff8000a34f7c20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6bc/0x1600 kernel/workqueue.c:3203 #2: ffff0000d4d18078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xc0/0x998 net/bluetooth/hci_event.c:6850 #3: ffff80008faafee0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:336 CPU: 0 UID: 0 PID: 5995 Comm: kworker/u9:1 Not tainted 6.12.0-syzkaller-00237-g7b1d1d4cfac0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 hci_rx_work Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 __might_resched+0x374/0x4d0 kernel/sched/core.c:8656 __might_sleep+0x90/0xe4 kernel/sched/core.c:8585 __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:1957 [inline] hci_le_create_big_complete_evt+0x348/0x998 net/bluetooth/hci_event.c:6875 hci_le_meta_evt+0x2a4/0x478 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x890/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x318/0xa80 net/bluetooth/hci_core.c:4029 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 ============================= [ BUG: Invalid wait context ] 6.12.0-syzkaller-00237-g7b1d1d4cfac0 #0 Tainted: G W ----------------------------- kworker/u9:1/5995 is trying to lock: ffff800092954e08 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1957 [inline] ffff800092954e08 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0x348/0x998 net/bluetooth/hci_event.c:6875 other info that might help us debug this: context-{4:4} 4 locks held by kworker/u9:1/5995: #0: ffff0000d5128148 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x628/0x1600 kernel/workqueue.c:3203 #1: ffff8000a34f7c20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x6bc/0x1600 kernel/workqueue.c:3203 #2: ffff0000d4d18078 (&hdev->lock){+.+.}-{3:3}, at: hci_le_create_big_complete_evt+0xc0/0x998 net/bluetooth/hci_event.c:6850 #3: ffff80008faafee0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:336 stack backtrace: CPU: 0 UID: 0 PID: 5995 Comm: kworker/u9:1 Tainted: G W 6.12.0-syzkaller-00237-g7b1d1d4cfac0 #0 Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 hci_rx_work Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_lock_invalid_wait_context kernel/locking/lockdep.c:4802 [inline] check_wait_context kernel/locking/lockdep.c:4874 [inline] __lock_acquire+0x1f40/0x77c8 kernel/locking/lockdep.c:5152 lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5825 __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:1957 [inline] hci_le_create_big_complete_evt+0x348/0x998 net/bluetooth/hci_event.c:6875 hci_le_meta_evt+0x2a4/0x478 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x890/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x318/0xa80 net/bluetooth/hci_core.c:4029 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 ================================================================== BUG: KASAN: slab-use-after-free in hci_le_create_big_complete_evt+0x300/0x998 Read of size 8 at addr ffff0000dacb4000 by task kworker/u9:1/5995 CPU: 0 UID: 0 PID: 5995 Comm: kworker/u9:1 Tainted: G W 6.12.0-syzkaller-00237-g7b1d1d4cfac0 #0 Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 hci_rx_work Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 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+0x300/0x998 hci_le_meta_evt+0x2a4/0x478 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x890/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x318/0xa80 net/bluetooth/hci_core.c:4029 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 Allocated by task 5995: 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:377 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __kmalloc_cache_noprof+0x244/0x378 mm/slub.c:4295 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] __hci_conn_add+0x25c/0x13cc net/bluetooth/hci_conn.c:935 hci_conn_add+0x70/0x88 net/bluetooth/hci_conn.c:1053 hci_le_big_sync_established_evt+0x360/0x9ec net/bluetooth/hci_event.c:6920 hci_le_meta_evt+0x2a4/0x478 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x890/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x318/0xa80 net/bluetooth/hci_core.c:4029 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 Freed by task 5995: 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 mm/kasan/common.c:247 [inline] __kasan_slab_free+0x64/0x8c mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x184/0x47c mm/slub.c:4727 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:3780 hci_conn_del_sysfs+0x7c/0x170 net/bluetooth/hci_sysfs.c:72 hci_conn_cleanup net/bluetooth/hci_conn.c:174 [inline] hci_conn_del+0x72c/0xaa0 net/bluetooth/hci_conn.c:1163 hci_le_create_big_complete_evt+0x55c/0x998 net/bluetooth/hci_event.c:6877 hci_le_meta_evt+0x2a4/0x478 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x890/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x318/0xa80 net/bluetooth/hci_core.c:4029 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 The buggy address belongs to the object at ffff0000dacb4000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 0 bytes inside of freed 8192-byte region [ffff0000dacb4000, ffff0000dacb6000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11acb0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 ksm flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff) page_type: f5(slab) raw: 05ffc00000000040 ffff0000c0002280 fffffdffc30b7200 0000000000000003 raw: 0000000000000000 0000000080020002 00000001f5000000 0000000000000000 head: 05ffc00000000040 ffff0000c0002280 fffffdffc30b7200 0000000000000003 head: 0000000000000000 0000000080020002 00000001f5000000 0000000000000000 head: 05ffc00000000003 fffffdffc36b2c01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000dacb3f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000dacb3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff0000dacb4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000dacb4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000dacb4100: 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 UID: 0 PID: 5995 Comm: kworker/u9:1 Tainted: G B W 6.12.0-syzkaller-00237-g7b1d1d4cfac0 #0 Tainted: [B]=BAD_PAGE, [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: hci0 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+0x210/0x998 net/bluetooth/hci_event.c:6855 sp : ffff8000a34f7710 x29: ffff8000a34f7720 x28: ffff800092954d80 x27: 1ffff0001469eef4 x26: ffff0000d17d1dbb x25: dfff800000000000 x24: dfff800000000000 x23: ffff8000a34f77c0 x22: 0000000000000014 x21: 0000000000000014 x20: ffff8000a34f77c0 x19: 0000000000000006 x18: 0000000000000008 x17: 3d3d3d3d3d3d3d3d x16: ffff80008b47f808 x15: ffff70001469eef8 x14: 1ffff0001469eef8 x13: 0000000000000006 x12: ffffffffffffffff x11: ffff70001469eef8 x10: 1ffff0001469eef8 x9 : 0000000000000004 x8 : 0000000000000002 x7 : 0000000000000000 x6 : ffff80008b6227cc x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff80008a6ac38c x2 : 0000000000000006 x1 : ffff8000a34f77c0 x0 : 0000000000000014 Call trace: memcmp lib/string.c:676 [inline] (P) bcmp+0x134/0x1c8 lib/string.c:697 (P) bacmp include/net/bluetooth/bluetooth.h:366 [inline] (L) hci_le_create_big_complete_evt+0x210/0x998 net/bluetooth/hci_event.c:6855 (L) bacmp include/net/bluetooth/bluetooth.h:366 [inline] hci_le_create_big_complete_evt+0x210/0x998 net/bluetooth/hci_event.c:6855 hci_le_meta_evt+0x2a4/0x478 net/bluetooth/hci_event.c:7132 hci_event_func net/bluetooth/hci_event.c:7440 [inline] hci_event_packet+0x890/0x106c net/bluetooth/hci_event.c:7495 hci_rx_work+0x318/0xa80 net/bluetooth/hci_core.c:4029 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:862 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