================================================================== BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline] BUG: KASAN: slab-use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:252 [inline] BUG: KASAN: slab-use-after-free in __refcount_add include/linux/refcount.h:182 [inline] BUG: KASAN: slab-use-after-free in __refcount_inc include/linux/refcount.h:239 [inline] BUG: KASAN: slab-use-after-free in refcount_inc include/linux/refcount.h:256 [inline] BUG: KASAN: slab-use-after-free in sock_hold include/net/sock.h:760 [inline] BUG: KASAN: slab-use-after-free in sco_sock_timeout+0x64/0x25c net/bluetooth/sco.c:88 Write of size 4 at addr ffff0000d3af4080 by task kworker/0:3/5971 CPU: 0 PID: 5971 Comm: kworker/0:3 Not tainted 6.8.0-rc7-syzkaller-g707081b61156 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: events sco_sock_timeout Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:291 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:298 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd0/0x124 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x178/0x518 mm/kasan/report.c:488 kasan_report+0xd8/0x138 mm/kasan/report.c:601 kasan_check_range+0x254/0x294 mm/kasan/generic.c:189 __kasan_check_write+0x20/0x30 mm/kasan/shadow.c:37 instrument_atomic_read_write include/linux/instrumented.h:96 [inline] atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:252 [inline] __refcount_add include/linux/refcount.h:182 [inline] __refcount_inc include/linux/refcount.h:239 [inline] refcount_inc include/linux/refcount.h:256 [inline] sock_hold include/net/sock.h:760 [inline] sco_sock_timeout+0x64/0x25c net/bluetooth/sco.c:88 process_one_work+0x694/0x1204 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:2787 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Allocated by task 9500: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:575 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:3981 [inline] __kmalloc_node+0x2fc/0x624 mm/slub.c:3988 kmalloc_node include/linux/slab.h:610 [inline] kzalloc_node include/linux/slab.h:722 [inline] qdisc_alloc+0x90/0x75c net/sched/sch_generic.c:940 qdisc_create_dflt+0x70/0x518 net/sched/sch_generic.c:998 mq_init+0x26c/0x5e4 net/sched/sch_mq.c:90 qdisc_create_dflt+0x118/0x518 net/sched/sch_generic.c:1005 attach_default_qdiscs net/sched/sch_generic.c:1186 [inline] dev_activate+0x1e4/0x105c net/sched/sch_generic.c:1240 __dev_open+0x3ac/0x500 net/core/dev.c:1455 __dev_change_flags+0x1a8/0x5a0 net/core/dev.c:8648 dev_change_flags+0x80/0x15c net/core/dev.c:8720 dev_ifsioc+0x134/0x9a8 net/core/dev_ioctl.c:530 dev_ioctl+0x4d8/0xd34 net/core/dev_ioctl.c:787 sock_do_ioctl+0x1d4/0x2d0 net/socket.c:1236 sock_ioctl+0x4ec/0x838 net/socket.c:1341 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:871 [inline] __se_sys_ioctl fs/ioctl.c:857 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:857 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Freed by task 6160: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:589 poison_slab_object+0x124/0x18c mm/kasan/common.c:240 __kasan_slab_free+0x3c/0x70 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kfree+0x144/0x3cc mm/slub.c:4409 qdisc_free net/sched/sch_generic.c:1041 [inline] qdisc_free_cb+0xac/0xcc net/sched/sch_generic.c:1048 rcu_do_batch kernel/rcu/tree.c:2190 [inline] rcu_core+0x890/0x1b34 kernel/rcu/tree.c:2465 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2482 __do_softirq+0x2d8/0xce4 kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:47 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:551 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:561 __call_rcu_common kernel/rcu/tree.c:2715 [inline] call_rcu+0x104/0xaf4 kernel/rcu/tree.c:2829 __qdisc_destroy+0x284/0x4b8 net/sched/sch_generic.c:1074 qdisc_put net/sched/sch_generic.c:1094 [inline] shutdown_scheduler_queue+0x168/0x200 net/sched/sch_generic.c:1147 netdev_for_each_tx_queue include/linux/netdevice.h:2578 [inline] dev_shutdown+0xa0/0x480 net/sched/sch_generic.c:1479 unregister_netdevice_many_notify+0x7f4/0x17b8 net/core/dev.c:11073 unregister_netdevice_many net/core/dev.c:11139 [inline] unregister_netdevice_queue+0x2d8/0x324 net/core/dev.c:11019 unregister_netdevice include/linux/netdevice.h:3195 [inline] __tun_detach+0x584/0x12cc drivers/net/tun.c:685 tun_detach drivers/net/tun.c:701 [inline] tun_chr_close+0x118/0x1f8 drivers/net/tun.c:3506 __fput+0x30c/0x738 fs/file_table.c:376 __fput_sync+0x60/0x9c fs/file_table.c:461 __do_sys_close fs/open.c:1554 [inline] __se_sys_close fs/open.c:1539 [inline] __arm64_sys_close+0x150/0x1e0 fs/open.c:1539 __invoke_syscall arch/arm64/kernel/syscall.c:34 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:48 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:133 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:152 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 The buggy address belongs to the object at ffff0000d3af4000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 128 bytes inside of freed 2048-byte region [ffff0000d3af4000, ffff0000d3af4800) The buggy address belongs to the physical page: page:0000000003d56e5a refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000d3af6000 pfn:0x113af0 head:0000000003d56e5a order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x5ffc00000000a40(workingset|slab|head|node=0|zone=2|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 05ffc00000000a40 ffff0000c0002000 fffffdffc343f210 fffffdffc3550410 raw: ffff0000d3af6000 0000000000080002 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d3af3f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000d3af4000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000d3af4080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000d3af4100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000d3af4180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: saturated; leaking memory. WARNING: CPU: 0 PID: 5971 at lib/refcount.c:22 refcount_warn_saturate+0x188/0x20c lib/refcount.c:22 Modules linked in: CPU: 0 PID: 5971 Comm: kworker/0:3 Tainted: G B 6.8.0-rc7-syzkaller-g707081b61156 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: events sco_sock_timeout pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : refcount_warn_saturate+0x188/0x20c lib/refcount.c:22 lr : refcount_warn_saturate+0x188/0x20c lib/refcount.c:22 sp : ffff800097777af0 x29: ffff800097777af0 x28: 1fffe00018f36d8a x27: dfff800000000000 x26: ffff0000c1084008 x25: ffff0000c79b6c50 x24: ffff0001b4013700 x23: dfff800000000000 x22: 00000000d3af4081 x21: 0000000000000001 x20: ffff0000d3af4080 x19: ffff800091cc2000 x18: ffff8000977777e0 x17: 0000000000000000 x16: ffff80008aca6b80 x15: 0000000000000001 x14: 1ffff00012eeee78 x13: 0000000000000000 x12: 0000000000000000 x11: 0000000000000003 x10: 0000000000ff0100 x9 : 3ba975f6ad745d00 x8 : 3ba975f6ad745d00 x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff8000977773d8 x4 : ffff80008ed822c0 x3 : ffff80008036f0d8 x2 : 0000000000000001 x1 : 0000000000000001 x0 : 0000000000000000 Call trace: refcount_warn_saturate+0x188/0x20c lib/refcount.c:22 __refcount_inc include/linux/refcount.h:239 [inline] refcount_inc include/linux/refcount.h:256 [inline] sock_hold include/net/sock.h:760 [inline] sco_sock_timeout+0x19c/0x25c net/bluetooth/sco.c:88 process_one_work+0x694/0x1204 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:2787 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 irq event stamp: 360693 hardirqs last enabled at (360693): [] __exit_to_kernel_mode arch/arm64/kernel/entry-common.c:85 [inline] hardirqs last enabled at (360693): [] exit_to_kernel_mode+0xdc/0x10c arch/arm64/kernel/entry-common.c:95 hardirqs last disabled at (360692): [] __do_softirq+0x958/0xce4 kernel/softirq.c:569 softirqs last enabled at (360202): [] local_bh_enable+0xc/0x2c include/linux/bottom_half.h:32 softirqs last disabled at (360198): [] local_bh_disable+0xc/0x2c include/linux/bottom_half.h:19 ---[ end trace 0000000000000000 ]--- Unable to handle kernel execute from non-executable memory at virtual address ffff8000938207e0 KASAN: probably user-memory-access in range [0x000000049c103f00-0x000000049c103f07] Mem abort info: ESR = 0x000000008600000f EC = 0x21: IABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x0f: level 3 permission fault swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000001adbd5000 [ffff8000938207e0] pgd=10000001b2c71003, p4d=10000001b2c71003, pud=10000001b2c72003, pmd=10000001b2c78003, pte=00780001b2c20703 Internal error: Oops: 000000008600000f [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 5971 Comm: kworker/0:3 Tainted: G B W 6.8.0-rc7-syzkaller-g707081b61156 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: events sco_sock_timeout pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : ptr_ring_init.__key.22+0x0/0x20 lr : sco_sock_timeout+0xf4/0x25c net/bluetooth/sco.c:98 sp : ffff800097777b20 x29: ffff800097777b20 x28: 1fffe00018f36d8a x27: dfff800000000000 x26: ffff0000c1084008 x25: ffff0000c79b6c50 x24: ffff0001b4013700 x23: dfff800000000000 x22: 00000000d3af4081 x21: ffff0000c79b6c08 x20: ffff0000d3af4000 x19: ffff0000d3af4080 x18: 1fffe000367fff96 x17: ffff80008ae48dbc x16: ffff8000809fd6d8 x15: ffff60001a75e813 x14: 1fffe0001a75e813 x13: 00000000000000fb x12: ffffffffffffffff x11: ffff80009776ffff x10: 0000000000ff0100 x9 : ffff800093486880 x8 : ffff8000938207e0 x7 : ffff8000809fcfa8 x6 : ffff800088eaf8bc x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff800089fa2f38 x2 : 0000000000000000 x1 : 0000000000000008 x0 : ffff0000d3af4000 Call trace: ptr_ring_init.__key.22+0x0/0x20 process_one_work+0x694/0x1204 kernel/workqueue.c:2633 process_scheduled_works kernel/workqueue.c:2706 [inline] worker_thread+0x938/0xef4 kernel/workqueue.c:2787 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Code: 00000000 00000000 00000000 00000000 (00000000) ---[ end trace 0000000000000000 ]---