================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x3d86/0x54a0 kernel/locking/lockdep.c:4885 Read of size 8 at addr ffff88803475a0a0 by task kworker/1:1/8632 CPU: 1 PID: 8632 Comm: kworker/1:1 Not tainted 5.14.0-rc5-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/0x309 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+0x3d86/0x54a0 kernel/locking/lockdep.c:4885 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 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+0x40/0x120 net/core/sock.c:3162 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+0x98d/0x1630 kernel/workqueue.c:2276 worker_thread+0x658/0x11f0 kernel/workqueue.c:2422 kthread+0x3e5/0x4d0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 13557: 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+0x9b/0xd0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0x110/0x290 net/core/sock.c:1808 sk_alloc+0x32/0xbc0 net/core/sock.c:1861 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:1450 sock_create net/socket.c:1501 [inline] __sys_socket+0xef/0x200 net/socket.c:1543 __do_sys_socket net/socket.c:1552 [inline] __se_sys_socket net/socket.c:1550 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1550 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 13555: 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+0xfb/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1625 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1650 slab_free mm/slub.c:3210 [inline] kfree+0xe4/0x530 mm/slub.c:4264 sk_prot_free net/core/sock.c:1844 [inline] __sk_destruct+0x6a8/0x900 net/core/sock.c:1929 sk_destruct+0xbd/0xe0 net/core/sock.c:1944 __sk_free+0xef/0x3d0 net/core/sock.c:1955 sk_free+0x78/0xa0 net/core/sock.c:1966 sock_put include/net/sock.h:1816 [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:648 sock_close+0x18/0x20 net/socket.c:1300 __fput+0x288/0x920 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 ffff88803475a000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff88803475a000, ffff88803475a800) The buggy address belongs to the page: page:ffffea0000d1d600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x34758 head:ffffea0000d1d600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000700000001 ffff888010842000 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 8913, ts 1582835437585, free_ts 1582828742119 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4169 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5391 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2244 alloc_slab_page mm/slub.c:1688 [inline] allocate_slab+0x32e/0x4b0 mm/slub.c:1828 new_slab mm/slub.c:1891 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x4ba/0x820 mm/slub.c:2800 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc+0x312/0x330 mm/slub.c:4108 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0x110/0x290 net/core/sock.c:1808 sk_alloc+0x32/0xbc0 net/core/sock.c:1861 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:1450 sock_create net/socket.c:1501 [inline] __sys_socket+0xef/0x200 net/socket.c:1543 __do_sys_socket net/socket.c:1552 [inline] __se_sys_socket net/socket.c:1550 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1550 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/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: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 unfreeze_partials+0x17c/0x1d0 mm/slub.c:2418 put_cpu_partial+0x13d/0x230 mm/slub.c:2454 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x8e/0xa0 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:2956 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc_trace+0x26d/0x3c0 mm/slub.c:2981 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] apparmor_sk_alloc_security+0x84/0x150 security/apparmor/lsm.c:785 security_sk_alloc+0x50/0xb0 security/security.c:2261 sk_prot_alloc+0x1e5/0x290 net/core/sock.c:1811 sk_alloc+0x32/0xbc0 net/core/sock.c:1861 inet6_create net/ipv6/af_inet6.c:183 [inline] inet6_create+0x36f/0x1030 net/ipv6/af_inet6.c:110 __sock_create+0x353/0x790 net/socket.c:1450 sock_create net/socket.c:1501 [inline] __sys_socket+0xef/0x200 net/socket.c:1543 __do_sys_socket net/socket.c:1552 [inline] __se_sys_socket net/socket.c:1550 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1550 Memory state around the buggy address: ffff888034759f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88803475a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803475a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803475a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803475a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================