================================================================== BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:72 [inline] BUG: KASAN: use-after-free in atomic_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline] BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0xa6/0x5e0 kernel/locking/mutex.c:916 Read of size 8 at addr ffff88805e20a4b8 by task syz-executor.0/11876 CPU: 3 PID: 11876 Comm: syz-executor.0 Not tainted 6.1.0-rc2-syzkaller-00078-g98555239e4c3 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbb/0x1f0 mm/kasan/report.c:495 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:72 [inline] atomic_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline] __mutex_unlock_slowpath+0xa6/0x5e0 kernel/locking/mutex.c:916 l2cap_chan_unlock include/net/bluetooth/l2cap.h:860 [inline] l2cap_conn_del+0x404/0x7b0 net/bluetooth/l2cap_core.c:1932 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:8221 [inline] l2cap_disconn_cfm+0x8c/0xc0 net/bluetooth/l2cap_core.c:8214 hci_disconn_cfm include/net/bluetooth/hci_core.h:1787 [inline] hci_conn_hash_flush+0x122/0x260 net/bluetooth/hci_conn.c:2430 hci_dev_close_sync+0x5f7/0x1200 net/bluetooth/hci_sync.c:4824 hci_dev_do_close+0x2d/0x70 net/bluetooth/hci_core.c:554 hci_rfkill_set_block+0x15d/0x1c0 net/bluetooth/hci_core.c:956 rfkill_set_block+0x1f9/0x540 net/rfkill/core.c:345 rfkill_fop_write+0x2c3/0x570 net/rfkill/core.c:1286 vfs_write+0x2d7/0xdd0 fs/read_write.c:582 ksys_write+0x1e8/0x250 fs/read_write.c:637 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7f63549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f7f5e5cc EFLAGS: 00000296 ORIG_RAX: 0000000000000004 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000040 RDX: 0000000000000008 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 63: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_kmalloc+0xa1/0xb0 mm/kasan/common.c:380 kmalloc include/linux/slab.h:576 [inline] kzalloc include/linux/slab.h:712 [inline] l2cap_chan_create+0x40/0x930 net/bluetooth/l2cap_core.c:466 a2mp_chan_open net/bluetooth/a2mp.c:771 [inline] amp_mgr_create+0x8f/0x960 net/bluetooth/a2mp.c:862 a2mp_channel_create+0x7d/0x150 net/bluetooth/a2mp.c:894 l2cap_data_channel net/bluetooth/l2cap_core.c:7578 [inline] l2cap_recv_frame+0x51e5/0x9aa0 net/bluetooth/l2cap_core.c:7733 l2cap_recv_acldata+0xaa6/0xc00 net/bluetooth/l2cap_core.c:8438 hci_acldata_packet net/bluetooth/hci_core.c:3809 [inline] hci_rx_work+0x705/0x1230 net/bluetooth/hci_core.c:4044 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Freed by task 11876: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2a/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0xab/0x3b0 mm/slub.c:3674 l2cap_chan_destroy net/bluetooth/l2cap_core.c:509 [inline] kref_put include/linux/kref.h:65 [inline] l2cap_chan_put+0x22a/0x2d0 net/bluetooth/l2cap_core.c:533 l2cap_conn_del+0x3fc/0x7b0 net/bluetooth/l2cap_core.c:1930 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:8221 [inline] l2cap_disconn_cfm+0x8c/0xc0 net/bluetooth/l2cap_core.c:8214 hci_disconn_cfm include/net/bluetooth/hci_core.h:1787 [inline] hci_conn_hash_flush+0x122/0x260 net/bluetooth/hci_conn.c:2430 hci_dev_close_sync+0x5f7/0x1200 net/bluetooth/hci_sync.c:4824 hci_dev_do_close+0x2d/0x70 net/bluetooth/hci_core.c:554 hci_rfkill_set_block+0x15d/0x1c0 net/bluetooth/hci_core.c:956 rfkill_set_block+0x1f9/0x540 net/rfkill/core.c:345 rfkill_fop_write+0x2c3/0x570 net/rfkill/core.c:1286 vfs_write+0x2d7/0xdd0 fs/read_write.c:582 ksys_write+0x1e8/0x250 fs/read_write.c:637 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 call_rcu+0x99/0x820 kernel/rcu/tree.c:2798 netlink_release+0xeff/0x1db0 net/netlink/af_netlink.c:815 __sock_release net/socket.c:650 [inline] sock_release+0x87/0x1b0 net/socket.c:678 netlink_kernel_release+0x4b/0x60 net/netlink/af_netlink.c:2107 ops_exit_list+0xb0/0x170 net/core/net_namespace.c:169 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:601 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 call_rcu+0x99/0x820 kernel/rcu/tree.c:2798 netlink_release+0xeff/0x1db0 net/netlink/af_netlink.c:815 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x18/0x20 net/socket.c:1365 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16b/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:296 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff88805e20a000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1208 bytes inside of 2048-byte region [ffff88805e20a000, ffff88805e20a800) The buggy address belongs to the physical page: page:ffffea0001788200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805e20d000 pfn:0x5e208 head:ffffea0001788200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000010200 ffffea00015f3e08 ffffea0001c9d608 ffff888011842f00 raw: ffff88805e20d000 0000000000080004 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5377, tgid 5374 (syz-executor.1), ts 218654661680, free_ts 218626071512 prep_new_page mm/page_alloc.c:2538 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4287 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5554 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x191/0x3e0 mm/slub.c:3437 kmalloc_trace+0x22/0x60 mm/slab_common.c:1046 kmalloc include/linux/slab.h:576 [inline] kzalloc include/linux/slab.h:712 [inline] fib6_net_init net/ipv6/ip6_fib.c:2376 [inline] fib6_net_init+0x1d7/0xa20 net/ipv6/ip6_fib.c:2351 ops_init+0xb9/0x680 net/core/net_namespace.c:135 setup_net+0x5d1/0xc50 net/core/net_namespace.c:332 copy_net_ns+0x318/0x760 net/core/net_namespace.c:478 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __ia32_sys_unshare+0x2c/0x40 kernel/fork.c:3257 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1458 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1508 free_unref_page_prepare mm/page_alloc.c:3386 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3482 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2586 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x62/0x80 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x2ac/0x3c0 mm/slub.c:3422 getname_flags.part.0+0x50/0x4f0 fs/namei.c:139 getname_flags+0x9a/0xe0 include/linux/audit.h:320 user_path_at_empty+0x2b/0x60 fs/namei.c:2875 user_path_at include/linux/namei.h:57 [inline] ksys_umount fs/namespace.c:1822 [inline] __do_sys_umount fs/namespace.c:1830 [inline] __se_sys_umount fs/namespace.c:1828 [inline] __ia32_sys_umount+0xf8/0x180 fs/namespace.c:1828 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Memory state around the buggy address: ffff88805e20a380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805e20a400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805e20a480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805e20a500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805e20a580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi