================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3c3c/0x52b0 kernel/locking/lockdep.c:4885 Read of size 8 at addr ffff88811e7090a0 by task kworker/0:3/2640 CPU: 0 PID: 2640 Comm: kworker/0:3 Not tainted 5.14.0-rc1-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+0xbd/0xe2 lib/dump_stack.c:105 print_address_description.constprop.0.cold+0x6c/0x2d6 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:436 __lock_acquire+0x3c3c/0x52b0 kernel/locking/lockdep.c:4885 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x212/0x5d0 kernel/locking/lockdep.c:5590 __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+0x39/0xf0 net/core/sock.c:3101 l2cap_sock_teardown_cb+0x83/0x3a0 net/bluetooth/l2cap_sock.c:1528 l2cap_chan_del+0x96/0x1010 net/bluetooth/l2cap_core.c:622 l2cap_chan_close+0xe2/0x9d0 net/bluetooth/l2cap_core.c:825 l2cap_chan_timeout+0x122/0x3a0 net/bluetooth/l2cap_core.c:436 process_one_work+0x84c/0x13d0 kernel/workqueue.c:2276 worker_thread+0x598/0x1040 kernel/workqueue.c:2422 kthread+0x38b/0x460 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 9159: 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+0x7a/0x90 mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc mm/slab.c:3702 [inline] __kmalloc+0x213/0x470 mm/slab.c:3711 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0xee/0x200 net/core/sock.c:1747 sk_alloc+0x27/0x8c0 net/core/sock.c:1800 l2cap_sock_alloc.constprop.0+0x22/0x200 net/bluetooth/l2cap_sock.c:1813 l2cap_sock_create+0xb1/0x190 net/bluetooth/l2cap_sock.c:1859 bt_sock_create+0x11a/0x250 net/bluetooth/af_bluetooth.c:130 __sock_create+0x22a/0x550 net/socket.c:1443 sock_create net/socket.c:1494 [inline] __sys_socket+0xd6/0x1a0 net/socket.c:1536 __do_sys_socket net/socket.c:1545 [inline] __se_sys_socket net/socket.c:1543 [inline] __x64_sys_socket+0x6a/0xb0 net/socket.c:1543 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 9159: 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+0xb2/0xe0 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:229 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x111/0x2d0 mm/slab.c:3803 sk_prot_free net/core/sock.c:1783 [inline] __sk_destruct+0x55b/0x6c0 net/core/sock.c:1868 l2cap_sock_release+0x166/0x1c0 net/bluetooth/l2cap_sock.c:1397 __sock_release+0xbb/0x270 net/socket.c:647 sock_close+0xf/0x20 net/socket.c:1293 __fput+0x209/0x870 fs/file_table.c:280 task_work_run+0xc0/0x160 kernel/task_work.c:164 get_signal+0x14af/0x1b70 kernel/signal.c:2581 arch_do_signal_or_restart+0x2a9/0x1d10 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+0x20e/0x280 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x40/0x70 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+0x87/0xb0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3029 [inline] call_rcu+0x118/0x7e0 kernel/rcu/tree.c:3109 netlink_release+0xb08/0x17e0 net/netlink/af_netlink.c:812 __sock_release+0xbb/0x270 net/socket.c:647 sock_close+0xf/0x20 net/socket.c:1293 __fput+0x209/0x870 fs/file_table.c:280 task_work_run+0xc0/0x160 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xaa0/0x25a0 kernel/exit.c:825 do_group_exit+0xe7/0x290 kernel/exit.c:922 __do_sys_exit_group kernel/exit.c:933 [inline] __se_sys_exit_group kernel/exit.c:931 [inline] __x64_sys_exit_group+0x35/0x40 kernel/exit.c:931 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 The buggy address belongs to the object at ffff88811e709000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff88811e709000, ffff88811e709800) The buggy address belongs to the page: page:00000000febf645d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11e709 flags: 0x17ffe0000000200(slab|node=0|zone=2|lastcpupid=0x3fff) raw: 017ffe0000000200 ffffea000479b4c8 ffffea00048eb8c8 ffff888100040800 raw: 0000000000000000 ffff88811e709000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88811e708f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88811e709000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88811e709080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811e709100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811e709180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 0 PID: 2640 at lib/refcount.c:28 refcount_warn_saturate+0x12b/0x140 lib/refcount.c:28 Modules linked in: CPU: 0 PID: 2640 Comm: kworker/0:3 Tainted: G B 5.14.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events l2cap_chan_timeout RIP: 0010:refcount_warn_saturate+0x12b/0x140 lib/refcount.c:28 Code: 17 fe 03 0f 0b e9 53 ff ff ff 48 89 df e8 ad b6 43 fe e9 23 ff ff ff 48 c7 c7 40 a5 33 88 c6 05 ce 27 fc 06 01 e8 39 17 fe 03 <0f> 0b e9 2c ff ff ff 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 41 RSP: 0018:ffffc900081d7cc0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff888102aa1018 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff8833df20 RDI: fffff5200103af8a RBP: 0000000000000003 R08: 0000000000000001 R09: ffff8881f6430e47 R10: ffffed103ec861c8 R11: 0000000063666572 R12: ffff88811e709060 R13: ffff8881122d44b8 R14: ffffffff88ab2b20 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881f6400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f63ba72f000 CR3: 000000011055e006 CR4: 00000000001706f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: l2cap_sock_kill+0x95/0x110 net/bluetooth/l2cap_sock.c:1225 l2cap_chan_timeout+0x171/0x3a0 net/bluetooth/l2cap_core.c:438 process_one_work+0x84c/0x13d0 kernel/workqueue.c:2276 worker_thread+0x598/0x1040 kernel/workqueue.c:2422 kthread+0x38b/0x460 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 irq event stamp: 517536 hardirqs last enabled at (517535): [] __cancel_work kernel/workqueue.c:3235 [inline] hardirqs last enabled at (517535): [] cancel_delayed_work+0x24d/0x360 kernel/workqueue.c:3257 hardirqs last disabled at (517534): [] try_to_grab_pending kernel/workqueue.c:1242 [inline] hardirqs last disabled at (517534): [] __cancel_work kernel/workqueue.c:3228 [inline] hardirqs last disabled at (517534): [] cancel_delayed_work+0x2ba/0x360 kernel/workqueue.c:3257 softirqs last enabled at (517530): [] do_softirq.part.0+0x13c/0x1e0 kernel/softirq.c:459 softirqs last disabled at (517536): [] spin_lock_bh include/linux/spinlock.h:359 [inline] softirqs last disabled at (517536): [] lock_sock_nested+0x39/0xf0 net/core/sock.c:3101 ---[ end trace 803a54e5e6f2bb2d ]---