================================================================== BUG: KASAN: use-after-free in __lock_acquire+0xfe/0x6100 kernel/locking/lockdep.c:4885 Read of size 8 at addr ffff8880331190a0 by task kworker/1:0/8670 CPU: 1 PID: 8670 Comm: kworker/1:0 Not tainted 5.14.0-rc6-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+0x1ae/0x29f lib/dump_stack.c:105 print_address_description+0x66/0x3b0 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report+0x163/0x210 mm/kasan/report.c:436 __lock_acquire+0xfe/0x6100 kernel/locking/lockdep.c:4885 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:175 spin_lock_bh include/linux/spinlock.h:359 [inline] lock_sock_nested+0x48/0x110 net/core/sock.c:3162 l2cap_sock_teardown_cb+0x76/0x360 net/bluetooth/l2cap_sock.c:1528 l2cap_chan_del+0xaf/0x610 net/bluetooth/l2cap_core.c:622 l2cap_chan_timeout+0x12c/0x280 net/bluetooth/l2cap_core.c:436 process_one_work+0x833/0x10c0 kernel/workqueue.c:2276 worker_thread+0xac1/0x1320 kernel/workqueue.c:2422 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 14308: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xcd/0x100 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x96/0x340 mm/slub.c:2986 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] l2cap_chan_create+0x4c/0x480 net/bluetooth/l2cap_core.c:450 l2cap_sock_alloc+0x136/0x1d0 net/bluetooth/l2cap_sock.c:1828 l2cap_sock_create+0x113/0x1d0 net/bluetooth/l2cap_sock.c:1859 bt_sock_create+0x15b/0x220 net/bluetooth/af_bluetooth.c:130 __sock_create+0x580/0x8d0 net/socket.c:1450 sock_create net/socket.c:1501 [inline] __sys_socket+0x115/0x350 net/socket.c:1543 __do_sys_socket net/socket.c:1552 [inline] __se_sys_socket net/socket.c:1550 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1550 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 14307: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x3d/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0x10d/0x150 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1628 [inline] slab_free_freelist_hook+0x1e8/0x2a0 mm/slub.c:1653 slab_free mm/slub.c:3213 [inline] kfree+0xcf/0x2e0 mm/slub.c:4267 l2cap_sock_release+0x159/0x1c0 net/bluetooth/l2cap_sock.c:1400 __sock_release net/socket.c:648 [inline] sock_close+0xd8/0x260 net/socket.c:1300 __fput+0x352/0x7b0 fs/file_table.c:280 task_work_run+0x146/0x1c0 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+0x201/0x220 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x26/0x60 kernel/entry/common.c:302 do_syscall_64+0x4c/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888033119000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff888033119000, ffff888033119800) The buggy address belongs to the page: page:ffffea0000cc4600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x33118 head:ffffea0000cc4600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888011042000 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 8771, ts 412181758795, free_ts 412161556871 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4168 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5390 alloc_slab_page mm/slub.c:1691 [inline] allocate_slab+0xf1/0x540 mm/slub.c:1831 new_slab mm/slub.c:1894 [inline] new_slab_objects mm/slub.c:2640 [inline] ___slab_alloc+0x1cf/0x350 mm/slub.c:2803 __slab_alloc mm/slub.c:2843 [inline] slab_alloc_node mm/slub.c:2925 [inline] slab_alloc mm/slub.c:2967 [inline] kmem_cache_alloc_trace+0x29d/0x340 mm/slub.c:2984 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] l2cap_chan_create+0x4c/0x480 net/bluetooth/l2cap_core.c:450 l2cap_sock_alloc+0x136/0x1d0 net/bluetooth/l2cap_sock.c:1828 l2cap_sock_create+0x113/0x1d0 net/bluetooth/l2cap_sock.c:1859 bt_sock_create+0x15b/0x220 net/bluetooth/af_bluetooth.c:130 __sock_create+0x580/0x8d0 net/socket.c:1450 sock_create net/socket.c:1501 [inline] __sys_socket+0x115/0x350 net/socket.c:1543 __do_sys_socket net/socket.c:1552 [inline] __se_sys_socket net/socket.c:1550 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1550 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae 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+0xc29/0xd20 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page+0x7e/0x550 mm/page_alloc.c:3411 free_slab mm/slub.c:1934 [inline] discard_slab mm/slub.c:1940 [inline] unfreeze_partials+0x18c/0x1e0 mm/slub.c:2421 put_cpu_partial+0xd2/0x210 mm/slub.c:2457 __slab_free+0x3a8/0x6b0 mm/slub.c:3107 do_slab_free mm/slub.c:3201 [inline] ___cache_free+0xfc/0x120 mm/slub.c:3220 qlist_free_all mm/kasan/quarantine.c:165 [inline] kasan_quarantine_reduce+0x151/0x1c0 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xd0 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:2959 [inline] slab_alloc mm/slub.c:2967 [inline] kmem_cache_alloc+0x1d1/0x340 mm/slub.c:2972 getname_flags+0xba/0x640 fs/namei.c:138 user_path_at_empty+0x28/0x50 fs/namei.c:2747 user_path_at include/linux/namei.h:57 [inline] vfs_statx+0x102/0x3d0 fs/stat.c:203 vfs_fstatat fs/stat.c:225 [inline] vfs_lstat include/linux/fs.h:3386 [inline] __do_sys_newlstat fs/stat.c:380 [inline] __se_sys_newlstat+0xab/0x770 fs/stat.c:374 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888033118f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888033119000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888033119080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888033119100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888033119180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================