================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline] BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline] BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline] BUG: KASAN: use-after-free in sock_hold include/net/sock.h:726 [inline] BUG: KASAN: use-after-free in sco_sock_timeout+0x64/0x290 net/bluetooth/sco.c:89 Write of size 4 at addr ffff88807ef5d080 by task kworker/0:1/14 CPU: 0 PID: 14 Comm: kworker/0:1 Tainted: G W 5.17.0-syzkaller-04796-g169e77764adc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events sco_sock_timeout Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xa5/0x3e0 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline] __refcount_add include/linux/refcount.h:193 [inline] __refcount_inc include/linux/refcount.h:250 [inline] refcount_inc include/linux/refcount.h:267 [inline] sock_hold include/net/sock.h:726 [inline] sco_sock_timeout+0x64/0x290 net/bluetooth/sco.c:89 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 8377: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:586 [inline] sk_prot_alloc+0x110/0x290 net/core/sock.c:1936 sk_alloc+0x36/0x770 net/core/sock.c:1989 __netlink_create+0x63/0x2f0 net/netlink/af_netlink.c:647 netlink_create+0x3ad/0x5e0 net/netlink/af_netlink.c:710 __sock_create+0x353/0x790 net/socket.c:1468 sock_create net/socket.c:1519 [inline] __sys_socket+0xef/0x200 net/socket.c:1561 __do_sys_socket net/socket.c:1570 [inline] __se_sys_socket net/socket.c:1568 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1568 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 3625: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:215 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3510 [inline] kfree+0xd6/0x4d0 mm/slub.c:4552 sk_prot_free net/core/sock.c:1972 [inline] __sk_destruct+0x5e5/0x710 net/core/sock.c:2058 sk_destruct+0x131/0x180 net/core/sock.c:2076 __sk_free+0xef/0x3d0 net/core/sock.c:2087 sk_free+0x78/0xa0 net/core/sock.c:2098 deferred_put_nlk_sk+0x151/0x2f0 net/netlink/af_netlink.c:745 rcu_do_batch kernel/rcu/tree.c:2535 [inline] rcu_core+0x7b1/0x1880 kernel/rcu/tree.c:2786 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3074 netlink_release+0xf08/0x1db0 net/netlink/af_netlink.c:815 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x18/0x20 net/socket.c:1318 __fput+0x286/0x9f0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xaff/0x2a30 kernel/exit.c:794 do_group_exit+0xd2/0x2f0 kernel/exit.c:924 get_signal+0x4b0/0x28c0 kernel/signal.c:2903 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:149 [inline] exit_to_user_mode_loop kernel/entry/common.c:187 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:222 __syscall_exit_to_user_mode_work kernel/entry/common.c:304 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:315 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3074 netlink_release+0xf08/0x1db0 net/netlink/af_netlink.c:815 __sock_release+0xcd/0x280 net/socket.c:650 sock_close+0x18/0x20 net/socket.c:1318 __fput+0x286/0x9f0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xaff/0x2a30 kernel/exit.c:794 do_group_exit+0xd2/0x2f0 kernel/exit.c:924 get_signal+0x4b0/0x28c0 kernel/signal.c:2903 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:149 [inline] exit_to_user_mode_loop kernel/entry/common.c:187 [inline] exit_to_user_mode_prepare+0x17d/0x290 kernel/entry/common.c:222 __syscall_exit_to_user_mode_work kernel/entry/common.c:304 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:315 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 ffff88807ef5d000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 128 bytes inside of 2048-byte region [ffff88807ef5d000, ffff88807ef5d800) The buggy address belongs to the page: page:ffffea0001fbd600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ef58 head:ffffea0001fbd600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888010c42000 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 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 5734, ts 702500511668, free_ts 701492561155 prep_new_page mm/page_alloc.c:2382 [inline] get_page_from_freelist+0xba2/0x3df0 mm/page_alloc.c:4123 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5349 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2262 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8df/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] slab_alloc mm/slub.c:3225 [inline] kmem_cache_alloc_trace+0x310/0x3f0 mm/slub.c:3256 kmalloc include/linux/slab.h:581 [inline] kzalloc include/linux/slab.h:714 [inline] l2cap_chan_create+0x40/0x570 net/bluetooth/l2cap_core.c:450 l2cap_sock_alloc.constprop.0+0x185/0x230 net/bluetooth/l2cap_sock.c:1866 l2cap_sock_create+0x123/0x1f0 net/bluetooth/l2cap_sock.c:1897 bt_sock_create+0x17c/0x340 net/bluetooth/af_bluetooth.c:130 __sock_create+0x353/0x790 net/socket.c:1468 sock_create net/socket.c:1519 [inline] __sys_socket+0xef/0x200 net/socket.c:1561 __do_sys_socket net/socket.c:1570 [inline] __se_sys_socket net/socket.c:1568 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1568 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1348 [inline] free_pcp_prepare+0x548/0xd10 mm/page_alloc.c:1400 free_unref_page_prepare mm/page_alloc.c:3269 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3364 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2523 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:239 [inline] slab_post_alloc_hook mm/slab.h:749 [inline] slab_alloc_node mm/slub.c:3217 [inline] slab_alloc mm/slub.c:3225 [inline] __kmalloc+0x200/0x350 mm/slub.c:4410 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:714 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_path_perm+0x368/0x400 security/tomoyo/file.c:831 tomoyo_path_symlink+0x94/0xe0 security/tomoyo/tomoyo.c:199 security_path_symlink+0xdf/0x150 security/security.c:1181 do_symlinkat+0x106/0x2e0 fs/namei.c:4323 __do_sys_symlink fs/namei.c:4350 [inline] __se_sys_symlink fs/namei.c:4348 [inline] __x64_sys_symlink+0x75/0x90 fs/namei.c:4348 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 Memory state around the buggy address: ffff88807ef5cf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807ef5d000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807ef5d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807ef5d100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807ef5d180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================