================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3d7f/0x50c0 kernel/locking/lockdep.c:4770 Read of size 8 at addr ffff88810f49a0a0 by task kworker/0:1/11 CPU: 0 PID: 11 Comm: kworker/0:1 Not tainted 5.12.0-rc3-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+0x114/0x13f0 net/bluetooth/l2cap_core.c:619 l2cap_chan_close+0x118/0xb10 net/bluetooth/l2cap_core.c:824 l2cap_chan_timeout+0x173/0x450 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 8396: 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 kasan_kmalloc include/linux/kasan.h:233 [inline] __do_kmalloc mm/slab.c:3695 [inline] __kmalloc+0x22f/0x440 mm/slab.c:3704 kmalloc include/linux/slab.h:559 [inline] sk_prot_alloc+0x14c/0x290 net/core/sock.c:1703 sk_alloc+0x32/0xbd0 net/core/sock.c:1756 __netlink_create+0x63/0x2c0 net/netlink/af_netlink.c:638 netlink_create+0x3a1/0x5d0 net/netlink/af_netlink.c:701 __sock_create+0x3ca/0x740 net/socket.c:1408 sock_create net/socket.c:1459 [inline] __sys_socket+0xef/0x200 net/socket.c:1501 __do_sys_socket net/socket.c:1510 [inline] __se_sys_socket net/socket.c:1508 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1508 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 0: 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 sk_prot_free net/core/sock.c:1739 [inline] __sk_destruct+0x641/0x860 net/core/sock.c:1824 sk_destruct+0xbd/0xe0 net/core/sock.c:1839 __sk_free+0xef/0x3d0 net/core/sock.c:1850 sk_free+0x78/0xa0 net/core/sock.c:1861 deferred_put_nlk_sk+0x151/0x2f0 net/netlink/af_netlink.c:738 rcu_do_batch kernel/rcu/tree.c:2559 [inline] rcu_core+0x722/0x14f0 kernel/rcu/tree.c:2794 __do_softirq+0x206/0xa44 kernel/softirq.c:345 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:345 __call_rcu kernel/rcu/tree.c:3039 [inline] call_rcu+0x118/0x7c0 kernel/rcu/tree.c:3114 netlink_release+0xd48/0x1cf0 net/netlink/af_netlink.c:810 __sock_release+0xcd/0x280 net/socket.c:599 sock_close+0x18/0x20 net/socket.c:1258 __fput+0x288/0x920 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x240/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 Second to 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:345 __call_rcu kernel/rcu/tree.c:3039 [inline] call_rcu+0x118/0x7c0 kernel/rcu/tree.c:3114 netlink_release+0xd48/0x1cf0 net/netlink/af_netlink.c:810 __sock_release+0xcd/0x280 net/socket.c:599 sock_close+0x18/0x20 net/socket.c:1258 __fput+0x288/0x920 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x240/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 ffff88810f49a000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff88810f49a000, ffff88810f49a800) The buggy address belongs to the page: page:000000003db776bc refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10f49a flags: 0x17ffe0000000200(slab) raw: 017ffe0000000200 ffffea00043d12c8 ffffea00047cc688 ffff888100040800 raw: 0000000000000000 ffff88810f49a000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88810f499f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88810f49a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88810f49a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88810f49a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88810f49a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== stack segment: 0000 [#1] PREEMPT SMP KASAN CPU: 0 PID: 11 Comm: kworker/0:1 Tainted: G B 5.12.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events l2cap_chan_timeout RIP: 0010:arch_atomic_fetch_sub arch/x86/include/asm/atomic.h:190 [inline] RIP: 0010:atomic_fetch_sub_release include/asm-generic/atomic-instrumented.h:221 [inline] RIP: 0010:__refcount_sub_and_test include/linux/refcount.h:272 [inline] RIP: 0010:__refcount_dec_and_test include/linux/refcount.h:315 [inline] RIP: 0010:refcount_dec_and_test include/linux/refcount.h:333 [inline] RIP: 0010:kref_put include/linux/kref.h:64 [inline] RIP: 0010:l2cap_chan_put+0x32/0x230 net/bluetooth/l2cap_core.c:503 Code: 55 48 89 fd 53 e8 5e 80 47 fa 48 85 ed 74 5d e8 54 80 47 fa 4c 8d 65 18 be 04 00 00 00 bb ff ff ff ff 4c 89 e7 e8 8e e8 8a fa 0f c1 5d 18 bf 01 00 00 00 89 de e8 9d 84 47 fa 83 fb 01 74 3b RSP: 0018:ffffc900000cfc88 EFLAGS: 00010202 RAX: 0000000000000001 RBX: 00000000ffffffff RCX: ffffffff872e8012 RDX: 0000000000000001 RSI: 0000000000000004 RDI: dead4ead00000018 RBP: dead4ead00000000 R08: 0000000000000001 R09: dead4ead0000001c R10: ffffffff873200ac R11: 0000000000000000 R12: dead4ead00000018 R13: ffff8881167bca70 R14: ffff88810f99e4b8 R15: ffff8881f6235e00 FS: 0000000000000000(0000) GS:ffff8881f6200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000536038 CR3: 0000000104749000 CR4: 0000000000350ef0 Call Trace: l2cap_sock_kill+0xbd/0x180 net/bluetooth/l2cap_sock.c:1217 l2cap_chan_timeout+0x1c1/0x450 net/bluetooth/l2cap_core.c:438 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 Modules linked in: ---[ end trace eeb6fcd0f7319a67 ]--- RIP: 0010:arch_atomic_fetch_sub arch/x86/include/asm/atomic.h:190 [inline] RIP: 0010:atomic_fetch_sub_release include/asm-generic/atomic-instrumented.h:221 [inline] RIP: 0010:__refcount_sub_and_test include/linux/refcount.h:272 [inline] RIP: 0010:__refcount_dec_and_test include/linux/refcount.h:315 [inline] RIP: 0010:refcount_dec_and_test include/linux/refcount.h:333 [inline] RIP: 0010:kref_put include/linux/kref.h:64 [inline] RIP: 0010:l2cap_chan_put+0x32/0x230 net/bluetooth/l2cap_core.c:503 Code: 55 48 89 fd 53 e8 5e 80 47 fa 48 85 ed 74 5d e8 54 80 47 fa 4c 8d 65 18 be 04 00 00 00 bb ff ff ff ff 4c 89 e7 e8 8e e8 8a fa 0f c1 5d 18 bf 01 00 00 00 89 de e8 9d 84 47 fa 83 fb 01 74 3b RSP: 0018:ffffc900000cfc88 EFLAGS: 00010202 RAX: 0000000000000001 RBX: 00000000ffffffff RCX: ffffffff872e8012 RDX: 0000000000000001 RSI: 0000000000000004 RDI: dead4ead00000018 RBP: dead4ead00000000 R08: 0000000000000001 R09: dead4ead0000001c R10: ffffffff873200ac R11: 0000000000000000 R12: dead4ead00000018 R13: ffff8881167bca70 R14: ffff88810f99e4b8 R15: ffff8881f6235e00 FS: 0000000000000000(0000) GS:ffff8881f6200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000002866708 CR3: 000000010f6ec000 CR4: 0000000000350ef0