BUG: sleeping function called from invalid context at net/core/sock.c:3487 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3556, name: kworker/u5:4 preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 6 locks held by kworker/u5:4/3556: #0: ffff888076991938 ((wq_completion)hci0#2){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267 #1: ffffc9000418fd20 ((work_completion)(&hdev->rx_work)){+.+.}-{0:0}, at: process_one_work+0x7a9/0x11d0 kernel/workqueue.c:2267 #2: ffff888077d9c078 (&hdev->lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0xaa/0xac0 net/bluetooth/hci_event.c:5021 #3: ffffffff8e3f0f48 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_connect_cfm include/net/bluetooth/hci_core.h:1790 [inline] #3: ffffffff8e3f0f48 (hci_cb_list_lock){+.+.}-{3:3}, at: hci_sync_conn_complete_evt+0x4d5/0xac0 net/bluetooth/hci_event.c:5107 #4: ffff88807e67ec20 (&conn->lock#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] #4: ffff88807e67ec20 (&conn->lock#2){+.+.}-{2:2}, at: sco_conn_ready net/bluetooth/sco.c:1278 [inline] #4: ffff88807e67ec20 (&conn->lock#2){+.+.}-{2:2}, at: sco_connect_cfm+0x279/0xb10 net/bluetooth/sco.c:1363 #5: ffff8880611ed130 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1748 [inline] #5: ffff8880611ed130 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_conn_ready net/bluetooth/sco.c:1291 [inline] #5: ffff8880611ed130 (sk_lock-AF_BLUETOOTH-BTPROTO_SCO){+.+.}-{0:0}, at: sco_connect_cfm+0x450/0xb10 net/bluetooth/sco.c:1363 Preemption disabled at: [<0000000000000000>] 0x0 CPU: 0 PID: 3556 Comm: kworker/u5:4 Not tainted 6.1.100-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Workqueue: hci0 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 __might_resched+0x5cb/0x780 kernel/sched/core.c:9945 lock_sock_nested+0x59/0x100 net/core/sock.c:3487 lock_sock include/net/sock.h:1748 [inline] sco_conn_ready net/bluetooth/sco.c:1291 [inline] sco_connect_cfm+0x450/0xb10 net/bluetooth/sco.c:1363 hci_connect_cfm include/net/bluetooth/hci_core.h:1793 [inline] hci_sync_conn_complete_evt+0x54b/0xac0 net/bluetooth/hci_event.c:5107 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0xa9d/0x1510 net/bluetooth/hci_event.c:7591 hci_rx_work+0x3cd/0xce0 net/bluetooth/hci_core.c:4129 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4919 Read of size 8 at addr ffff8880611ed0b0 by task kworker/u5:4/3556 CPU: 0 PID: 3556 Comm: kworker/u5:4 Tainted: G W 6.1.100-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Workqueue: hci0 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 __lock_acquire+0x77/0x1f80 kernel/locking/lockdep.c:4919 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:178 spin_lock_bh include/linux/spinlock.h:356 [inline] lock_sock_nested+0x66/0x100 net/core/sock.c:3488 lock_sock include/net/sock.h:1748 [inline] sco_conn_ready net/bluetooth/sco.c:1291 [inline] sco_connect_cfm+0x450/0xb10 net/bluetooth/sco.c:1363 hci_connect_cfm include/net/bluetooth/hci_core.h:1793 [inline] hci_sync_conn_complete_evt+0x54b/0xac0 net/bluetooth/hci_event.c:5107 hci_event_func net/bluetooth/hci_event.c:7539 [inline] hci_event_packet+0xa9d/0x1510 net/bluetooth/hci_event.c:7591 hci_rx_work+0x3cd/0xce0 net/bluetooth/hci_core.c:4129 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 6377: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:955 [inline] __kmalloc+0xb2/0x230 mm/slab_common.c:968 kmalloc include/linux/slab.h:561 [inline] sk_prot_alloc+0xe0/0x200 net/core/sock.c:2047 sk_alloc+0x36/0x350 net/core/sock.c:2100 bt_sock_alloc+0x37/0x130 net/bluetooth/af_bluetooth.c:148 sco_sock_alloc net/bluetooth/sco.c:487 [inline] sco_sock_create+0xb7/0x390 net/bluetooth/sco.c:518 bt_sock_create+0x159/0x220 net/bluetooth/af_bluetooth.c:132 __sock_create+0x488/0x910 net/socket.c:1550 sock_create net/socket.c:1601 [inline] __sys_socket_create net/socket.c:1638 [inline] __sys_socket+0x136/0x3a0 net/socket.c:1666 __do_sys_socket net/socket.c:1679 [inline] __se_sys_socket net/socket.c:1677 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1677 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 6376: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674 sk_prot_free net/core/sock.c:2083 [inline] __sk_destruct+0x473/0x5f0 net/core/sock.c:2169 sco_sock_release+0x259/0x310 net/bluetooth/sco.c:1260 __sock_release net/socket.c:654 [inline] sock_close+0xcd/0x230 net/socket.c:1400 __fput+0x3f6/0x8d0 fs/file_table.c:320 task_work_run+0x246/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486 call_rcu+0x163/0xa10 kernel/rcu/tree.c:2844 netlink_release+0x1554/0x19e0 net/netlink/af_netlink.c:815 __sock_release net/socket.c:654 [inline] sock_close+0xcd/0x230 net/socket.c:1400 __fput+0x3f6/0x8d0 fs/file_table.c:320 task_work_run+0x246/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xde/0x100 kernel/entry/common.c:177 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486 call_rcu+0x163/0xa10 kernel/rcu/tree.c:2844 netlink_release+0x1554/0x19e0 net/netlink/af_netlink.c:815 __sock_release net/socket.c:654 [inline] sock_release+0x7a/0x140 net/socket.c:682 rdma_dev_exit_net+0x2aa/0x350 drivers/infiniband/core/device.c:1152 ops_exit_list net/core/net_namespace.c:172 [inline] cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:604 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439 kthread+0x28d/0x320 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff8880611ed000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 176 bytes inside of 2048-byte region [ffff8880611ed000, ffff8880611ed800) The buggy address belongs to the physical page: page:ffffea0001847a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880611ef000 pfn:0x611e8 head:ffffea0001847a00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea000510b600 dead000000000002 ffff888012442000 raw: ffff8880611ef000 0000000080080006 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3547, tgid 3547 (syz-executor), ts 54217797188, free_ts 11427247735 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x322e/0x33b0 mm/page_alloc.c:4283 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5551 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1045 kmalloc include/linux/slab.h:556 [inline] kmalloc_array include/linux/slab.h:607 [inline] kcalloc include/linux/slab.h:639 [inline] addrconf_init_net+0x163/0x760 net/ipv6/addrconf.c:7192 ops_init+0x35d/0x610 net/core/net_namespace.c:138 setup_net+0x4b5/0xb90 net/core/net_namespace.c:335 copy_net_ns+0x392/0x5d0 net/core/net_namespace.c:481 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226 ksys_unshare+0x580/0xb20 kernel/fork.c:3203 __do_sys_unshare kernel/fork.c:3274 [inline] __se_sys_unshare kernel/fork.c:3272 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3272 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1444 [inline] free_pcp_prepare mm/page_alloc.c:1494 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3362 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3457 free_contig_range+0x9a/0x150 mm/page_alloc.c:9511 destroy_args+0xfe/0x997 mm/debug_vm_pgtable.c:1031 debug_vm_pgtable+0x416/0x46b mm/debug_vm_pgtable.c:1354 do_one_initcall+0x265/0x8f0 init/main.c:1298 do_initcall_level+0x157/0x207 init/main.c:1371 do_initcalls+0x49/0x86 init/main.c:1387 kernel_init_freeable+0x45c/0x60f init/main.c:1626 kernel_init+0x19/0x290 init/main.c:1514 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff8880611ecf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880611ed000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880611ed080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880611ed100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880611ed180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================