================================================================== 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 ffff88801e1a808c by task kworker/1:4/2979 CPU: 1 PID: 2979 Comm: kworker/1:4 Not tainted 5.14.0-rc6-next-20210820-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:106 print_address_description.constprop.0.cold+0x6c/0x309 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:373 [inline] lock_sock_nested+0x40/0x120 net/core/sock.c:3184 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+0x1ba/0xaf0 net/bluetooth/l2cap_core.c:825 l2cap_chan_timeout+0x182/0x2f0 net/bluetooth/l2cap_core.c:436 process_one_work+0x9c9/0x16b0 kernel/workqueue.c:2297 worker_thread+0x65b/0x1200 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 6922: 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+0xa8/0xe0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:599 [inline] sk_prot_alloc+0x114/0x2a0 net/core/sock.c:1822 sk_alloc+0x36/0xbe0 net/core/sock.c:1875 l2cap_sock_alloc.constprop.0+0x35/0x230 net/bluetooth/l2cap_sock.c:1813 l2cap_sock_create+0x127/0x1f0 net/bluetooth/l2cap_sock.c:1859 bt_sock_create+0x180/0x350 net/bluetooth/af_bluetooth.c:130 __sock_create+0x35f/0x7a0 net/socket.c:1461 sock_create net/socket.c:1512 [inline] __sys_socket+0xef/0x200 net/socket.c:1554 __do_sys_socket net/socket.c:1563 [inline] __se_sys_socket net/socket.c:1561 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1561 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 6921: 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+0x103/0x140 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1681 [inline] slab_free_freelist_hook+0x85/0x190 mm/slub.c:1706 slab_free mm/slub.c:3459 [inline] kfree+0xea/0x540 mm/slub.c:4519 sk_prot_free net/core/sock.c:1858 [inline] __sk_destruct+0x6b0/0x910 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+0x20b/0x250 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:1311 __fput+0x288/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 get_signal+0x1b45/0x2170 kernel/signal.c:2619 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+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88801e1a8000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 140 bytes inside of 2048-byte region [ffff88801e1a8000, ffff88801e1a8800) The buggy address belongs to the page: page:ffffea0000786a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1e1a8 head:ffffea0000786a00 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888010c42000 raw: 0000000000000000 0000000000080008 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 0x52a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 6922, ts 1586511989518, free_ts 1585704948033 prep_new_page mm/page_alloc.c:2424 [inline] get_page_from_freelist+0xa76/0x2f90 mm/page_alloc.c:4151 __alloc_pages+0x1ba/0x510 mm/page_alloc.c:5373 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2188 alloc_slab_page mm/slub.c:1744 [inline] allocate_slab mm/slub.c:1881 [inline] new_slab+0x321/0x490 mm/slub.c:1944 ___slab_alloc+0x937/0x1000 mm/slub.c:2970 __slab_alloc.constprop.0+0x51/0xa0 mm/slub.c:3057 slab_alloc_node mm/slub.c:3148 [inline] slab_alloc mm/slub.c:3190 [inline] __kmalloc+0x305/0x320 mm/slub.c:4363 kmalloc include/linux/slab.h:599 [inline] sk_prot_alloc+0x114/0x2a0 net/core/sock.c:1822 sk_alloc+0x36/0xbe0 net/core/sock.c:1875 l2cap_sock_alloc.constprop.0+0x35/0x230 net/bluetooth/l2cap_sock.c:1813 l2cap_sock_create+0x127/0x1f0 net/bluetooth/l2cap_sock.c:1859 bt_sock_create+0x180/0x350 net/bluetooth/af_bluetooth.c:130 __sock_create+0x35f/0x7a0 net/socket.c:1461 sock_create net/socket.c:1512 [inline] __sys_socket+0xef/0x200 net/socket.c:1554 __do_sys_socket net/socket.c:1563 [inline] __se_sys_socket net/socket.c:1561 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1561 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x377/0x860 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3315 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3394 __unfreeze_partials+0x184/0x1a0 mm/slub.c:2476 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xd0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x185/0x210 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa1/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3182 [inline] slab_alloc mm/slub.c:3190 [inline] kmem_cache_alloc_trace+0x265/0x3c0 mm/slub.c:3207 kmalloc include/linux/slab.h:594 [inline] kzalloc include/linux/slab.h:731 [inline] kernfs_fop_open+0x2ca/0xd50 fs/kernfs/file.c:628 do_dentry_open+0x4c8/0x11d0 fs/open.c:826 do_open fs/namei.c:3428 [inline] path_openat+0x1cbe/0x28b0 fs/namei.c:3561 do_filp_open+0x1aa/0x400 fs/namei.c:3588 do_sys_openat2+0x16d/0x4e0 fs/open.c:1204 do_sys_open fs/open.c:1220 [inline] __do_sys_open fs/open.c:1228 [inline] __se_sys_open fs/open.c:1224 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1224 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88801e1a7f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88801e1a8000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801e1a8080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801e1a8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801e1a8180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================