================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3d7f/0x50c0 kernel/locking/lockdep.c:4770 Read of size 8 at addr ffff8881035090a0 by task kworker/0:2/2619 CPU: 0 PID: 2619 Comm: kworker/0:2 Not tainted 5.12.0-rc4-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:79 [inline] dump_stack+0x185/0x1e4 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2c6 mm/kasan/report.c:232 __kasan_report mm/kasan/report.c:399 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416 __lock_acquire+0x3d7f/0x50c0 kernel/locking/lockdep.c:4770 lock_acquire kernel/locking/lockdep.c:5510 [inline] lock_acquire+0x212/0x850 kernel/locking/lockdep.c:5475 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175 spin_lock_bh include/linux/spinlock.h:359 [inline] lock_sock_nested+0x40/0x120 net/core/sock.c:3063 l2cap_sock_teardown_cb+0x89/0x400 net/bluetooth/l2cap_sock.c:1520 l2cap_chan_del+0xad/0x1300 net/bluetooth/l2cap_core.c:618 l2cap_chan_close+0x118/0xb10 net/bluetooth/l2cap_core.c:823 l2cap_chan_timeout+0xe9/0x390 net/bluetooth/l2cap_core.c:436 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 Allocated by task 6123: 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:427 [inline] ____kasan_kmalloc mm/kasan/common.c:506 [inline] __kasan_kmalloc+0x78/0x90 mm/kasan/common.c:515 kmalloc_node include/linux/slab.h:577 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:587 kvmalloc include/linux/mm.h:785 [inline] kvmalloc_array include/linux/mm.h:803 [inline] alloc_fdtable+0xcd/0x280 fs/file.c:120 dup_fd+0x726/0xc90 fs/file.c:325 copy_files kernel/fork.c:1474 [inline] copy_process+0x1f68/0x7050 kernel/fork.c:2095 kernel_clone+0xe7/0xab0 kernel/fork.c:2500 __do_sys_clone+0xc8/0x110 kernel/fork.c:2617 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 8260: 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:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xac/0xe0 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:199 [inline] __cache_free mm/slab.c:3440 [inline] kfree+0x10f/0x2d0 mm/slab.c:3796 kvfree+0x42/0x50 mm/util.c:616 __free_fdtable fs/file.c:36 [inline] put_files_struct fs/file.c:422 [inline] put_files_struct+0x270/0x350 fs/file.c:415 exit_files+0x7e/0xa0 fs/file.c:435 do_exit+0xc6b/0x2b40 kernel/exit.c:820 do_group_exit+0x125/0x310 kernel/exit.c:922 get_signal+0x42f/0x1fd0 kernel/signal.c:2777 arch_do_signal_or_restart+0x2a8/0x1f80 arch/x86/kernel/signal.c:789 handle_signal_work kernel/entry/common.c:147 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x1d6/0x250 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x40/0x80 kernel/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888103509000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff888103509000, ffff888103509800) The buggy address belongs to the page: page:0000000002ca8ad0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x103509 flags: 0x17ffe0000000200(slab) raw: 017ffe0000000200 ffffea00040eb308 ffffea00040e4c08 ffff888100040800 raw: 0000000000000000 ffff888103509000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888103508f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888103509000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888103509080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888103509100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888103509180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 2619 Comm: kworker/0:2 Tainted: G B 5.12.0-rc4-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:79 [inline] dump_stack+0x185/0x1e4 lib/dump_stack.c:120 assign_lock_key kernel/locking/lockdep.c:935 [inline] register_lock_class+0x111e/0x11f0 kernel/locking/lockdep.c:1247 __lock_acquire+0x100/0x50c0 kernel/locking/lockdep.c:4779 lock_acquire kernel/locking/lockdep.c:5510 [inline] lock_acquire+0x212/0x850 kernel/locking/lockdep.c:5475 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x2f/0x40 kernel/locking/spinlock.c:175 spin_lock_bh include/linux/spinlock.h:359 [inline] lock_sock_nested+0x40/0x120 net/core/sock.c:3063 l2cap_sock_teardown_cb+0x89/0x400 net/bluetooth/l2cap_sock.c:1520 l2cap_chan_del+0xad/0x1300 net/bluetooth/l2cap_core.c:618 l2cap_chan_close+0x118/0xb10 net/bluetooth/l2cap_core.c:823 l2cap_chan_timeout+0xe9/0x390 net/bluetooth/l2cap_core.c:436 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294