================================================================== BUG: KASAN: use-after-free in debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] BUG: KASAN: use-after-free in do_raw_spin_lock+0x262/0x2b0 kernel/locking/spinlock_debug.c:114 Read of size 4 at addr ffff888017b5108c by task kworker/1:4/4871 CPU: 1 PID: 4871 Comm: kworker/1:4 Not tainted 5.14.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events l2cap_chan_timeout Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:256 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 debug_spin_lock_before kernel/locking/spinlock_debug.c:85 [inline] do_raw_spin_lock+0x262/0x2b0 kernel/locking/spinlock_debug.c:114 spin_lock_bh include/linux/spinlock.h:368 [inline] lock_sock_nested+0x40/0x120 net/core/sock.c:3183 l2cap_sock_teardown_cb+0xa1/0x660 net/bluetooth/l2cap_sock.c:1528 l2cap_chan_del+0xbc/0xa80 net/bluetooth/l2cap_core.c:622 l2cap_chan_close+0x1b9/0xaf0 net/bluetooth/l2cap_core.c:825 l2cap_chan_timeout+0x17e/0x2f0 net/bluetooth/l2cap_core.c:436 process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297 worker_thread+0x658/0x11f0 kernel/workqueue.c:2444 kthread+0x3e5/0x4d0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 8979: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa1/0xd0 mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:264 [inline] __do_kmalloc mm/slab.c:3702 [inline] __kmalloc+0x214/0x4d0 mm/slab.c:3711 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0x110/0x290 net/core/sock.c:1822 sk_alloc+0x32/0xbc0 net/core/sock.c:1875 l2cap_sock_alloc.constprop.0+0x31/0x230 net/bluetooth/l2cap_sock.c:1813 l2cap_sock_create+0x123/0x1f0 net/bluetooth/l2cap_sock.c:1859 bt_sock_create+0x17c/0x340 net/bluetooth/af_bluetooth.c:130 __sock_create+0x353/0x790 net/socket.c:1464 sock_create net/socket.c:1515 [inline] __sys_socket+0xef/0x200 net/socket.c:1557 __do_sys_socket net/socket.c:1566 [inline] __se_sys_socket net/socket.c:1564 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1564 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 8979: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x10a/0x2c0 mm/slab.c:3803 sk_prot_free net/core/sock.c:1858 [inline] __sk_destruct+0x6a8/0x900 net/core/sock.c:1943 sk_destruct+0xbd/0xe0 net/core/sock.c:1958 __sk_free+0xef/0x3d0 net/core/sock.c:1969 sk_free+0x78/0xa0 net/core/sock.c:1980 sock_put include/net/sock.h:1815 [inline] l2cap_sock_kill+0x203/0x240 net/bluetooth/l2cap_sock.c:1227 l2cap_sock_release+0x184/0x200 net/bluetooth/l2cap_sock.c:1397 __sock_release+0xcd/0x280 net/socket.c:649 sock_close+0x18/0x20 net/socket.c:1314 __fput+0x288/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 get_signal+0x1b35/0x2160 kernel/signal.c:2641 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:865 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Last potentially related work creation: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_record_aux_stack+0xa7/0xd0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2987 [inline] call_rcu+0xb1/0x750 kernel/rcu/tree.c:3067 netlink_release+0xdd4/0x1dd0 net/netlink/af_netlink.c:812 __sock_release+0xcd/0x280 net/socket.c:649 sock_close+0x18/0x20 net/socket.c:1314 __fput+0x288/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888017b51000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 140 bytes inside of 2048-byte region [ffff888017b51000, ffff888017b51800) The buggy address belongs to the page: page:ffffea00005ed440 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17b51 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00006378c8 ffffea00005e2f08 ffff888010c40800 raw: 0000000000000000 ffff888017b51000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 371, ts 9155794363, free_ts 9149260142 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4168 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5390 __alloc_pages_node include/linux/gfp.h:570 [inline] kmem_getpages mm/slab.c:1377 [inline] cache_grow_begin+0x75/0x460 mm/slab.c:2593 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965 ____cache_alloc mm/slab.c:3048 [inline] ____cache_alloc mm/slab.c:3031 [inline] __do_cache_alloc mm/slab.c:3275 [inline] slab_alloc mm/slab.c:3316 [inline] __do_kmalloc mm/slab.c:3700 [inline] __kmalloc+0x3d5/0x4d0 mm/slab.c:3711 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] scsi_alloc_target+0x132/0xbb0 drivers/scsi/scsi_scan.c:445 __scsi_scan_target+0x13a/0xdb0 drivers/scsi/scsi_scan.c:1571 scsi_scan_channel drivers/scsi/scsi_scan.c:1676 [inline] scsi_scan_channel+0x148/0x1e0 drivers/scsi/scsi_scan.c:1652 scsi_scan_host_selected+0x2df/0x3b0 drivers/scsi/scsi_scan.c:1705 do_scsi_scan_host+0x1e8/0x260 drivers/scsi/scsi_scan.c:1844 do_scan_async+0x3e/0x500 drivers/scsi/scsi_scan.c:1854 async_run_entry_fn+0x9d/0x550 kernel/async.c:127 process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297 worker_thread+0x658/0x11f0 kernel/workqueue.c:2444 kthread+0x3e5/0x4d0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1346 [inline] free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3411 mm_free_pgd kernel/fork.c:648 [inline] __mmdrop+0xcb/0x3f0 kernel/fork.c:699 mmdrop include/linux/sched/mm.h:49 [inline] __mmput+0x3f1/0x4b0 kernel/fork.c:1124 mmput+0x58/0x60 kernel/fork.c:1135 free_bprm+0x65/0x2e0 fs/exec.c:1483 kernel_execve+0x380/0x460 fs/exec.c:1980 call_usermodehelper_exec_async+0x2e3/0x580 kernel/umh.c:112 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff888017b50f80: 00 00 00 00 00 00 00 00 04 fc fc fc fc fc fc fc ffff888017b51000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888017b51080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888017b51100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888017b51180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================