================================================================== BUG: KASAN: use-after-free in __lock_acquire+0xfe/0x6100 kernel/locking/lockdep.c:4885 Read of size 8 at addr ffff88802b8710a0 by task kworker/0:2/8679 CPU: 0 PID: 8679 Comm: kworker/0:2 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 15119: 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+0xc4/0xf0 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 15118: 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+0x109/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+0x1d8/0x290 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 Last potentially related work creation: kasan_save_stack+0x27/0x50 mm/kasan/common.c:38 kasan_record_aux_stack+0xee/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3029 [inline] call_rcu+0x1a0/0xa20 kernel/rcu/tree.c:3109 netlink_release+0x132d/0x1790 net/netlink/af_netlink.c:812 __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 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0x72b/0x2510 kernel/exit.c:825 do_group_exit+0x168/0x2d0 kernel/exit.c:922 __do_sys_exit_group+0x13/0x20 kernel/exit.c:933 __ia32_sys_exit_group+0x0/0x40 kernel/exit.c:931 __x64_sys_exit_group+0x37/0x40 kernel/exit.c:931 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 The buggy address belongs to the object at ffff88802b871000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff88802b871000, ffff88802b871800) The buggy address belongs to the page: page:ffffea0000ae1c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2b870 head:ffffea0000ae1c00 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 9008, ts 1588281704366, free_ts 1588216857365 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4169 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5391 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_kmalloc+0x2f/0xf0 mm/kasan/common.c:479 kasan_kmalloc include/linux/kasan.h:264 [inline] __kmalloc+0xb4/0x390 mm/slub.c:4115 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] tomoyo_encode2+0x25a/0x560 security/tomoyo/realpath.c:45 tomoyo_encode security/tomoyo/realpath.c:80 [inline] tomoyo_realpath_from_path+0x5c3/0x610 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x201/0x650 security/tomoyo/file.c:822 security_inode_getattr+0xc0/0x140 security/security.c:1333 vfs_getattr fs/stat.c:139 [inline] vfs_statx+0x188/0x3d0 fs/stat.c:207 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 Memory state around the buggy address: ffff88802b870f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802b871000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802b871080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802b871100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802b871180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================