================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline] BUG: KASAN: use-after-free in l2tp_session_delete+0x24/0x4a0 net/l2tp/l2tp_core.c:1563 Write of size 8 at addr ffff8881354d5c08 by task kworker/u4:2/3695 CPU: 1 PID: 3695 Comm: kworker/u4:2 Tainted: G W syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: l2tp l2tp_tunnel_del_work Call Trace: __dump_stack+0x21/0x30 lib/dump_stack.c:88 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0xf1/0x140 mm/kasan/report.c:444 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x280/0x290 mm/kasan/generic.c:189 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline] l2tp_session_delete+0x24/0x4a0 net/l2tp/l2tp_core.c:1563 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1218 [inline] l2tp_tunnel_del_work+0x1d2/0x3e0 net/l2tp/l2tp_core.c:1258 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472 kthread+0x411/0x500 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 6746: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:433 [inline] ____kasan_kmalloc mm/kasan/common.c:512 [inline] __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:521 kasan_kmalloc include/linux/kasan.h:227 [inline] __kmalloc+0x13d/0x2c0 mm/slub.c:4436 kmalloc include/linux/slab.h:624 [inline] kzalloc include/linux/slab.h:750 [inline] l2tp_session_create+0x39/0xb60 net/l2tp/l2tp_core.c:1599 pppol2tp_connect+0xb35/0x1570 net/l2tp/l2tp_ppp.c:782 __sys_connect_file net/socket.c:1923 [inline] __sys_connect+0x389/0x410 net/socket.c:1940 __do_sys_connect net/socket.c:1950 [inline] __se_sys_connect net/socket.c:1947 [inline] __x64_sys_connect+0x7a/0x90 net/socket.c:1947 x64_sys_call+0x7c/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:43 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 6754: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4a/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373 kasan_slab_free include/linux/kasan.h:193 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1754 slab_free mm/slub.c:3526 [inline] kfree+0xc4/0x270 mm/slub.c:4588 l2tp_session_free net/l2tp/l2tp_core.c:168 [inline] l2tp_session_dec_refcount+0xaf/0x1a0 net/l2tp/l2tp_core.c:205 pppol2tp_session_destruct+0xb1/0xf0 net/l2tp/l2tp_ppp.c:419 __sk_destruct+0x56/0x5e0 net/core/sock.c:1967 sk_destruct net/core/sock.c:2012 [inline] __sk_free+0x313/0x410 net/core/sock.c:2023 sk_free+0x54/0x90 net/core/sock.c:2034 sock_put include/net/sock.h:1975 [inline] pppol2tp_put_sk+0x7a/0xb0 net/l2tp/l2tp_ppp.c:402 rcu_do_batch+0x51d/0xba0 kernel/rcu/tree.c:2523 rcu_core+0x5e4/0xf80 kernel/rcu/tree.c:2763 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2776 handle_softirqs+0x250/0x560 kernel/softirq.c:583 __do_softirq kernel/softirq.c:621 [inline] invoke_softirq kernel/softirq.c:443 [inline] __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:670 irq_exit_rcu+0x9/0x10 kernel/softirq.c:682 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline] sysvec_apic_timer_interrupt+0xa9/0xc0 arch/x86/kernel/apic/apic.c:1108 asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:676 Last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 __call_rcu_common kernel/rcu/tree.c:3011 [inline] call_rcu+0x105/0xfe0 kernel/rcu/tree.c:3129 pppol2tp_release+0x208/0x2d0 net/l2tp/l2tp_ppp.c:458 __sock_release net/socket.c:649 [inline] sock_close+0xe0/0x270 net/socket.c:1336 __fput+0x20b/0x8b0 fs/file_table.c:311 ____fput+0x15/0x20 fs/file_table.c:339 task_work_run+0x127/0x190 kernel/task_work.c:188 get_signal+0x13fb/0x1480 kernel/signal.c:2679 arch_do_signal_or_restart+0xc1/0x10f0 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0xa7/0xe0 kernel/entry/common.c:178 exit_to_user_mode_prepare+0x87/0xd0 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:307 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Second to last potentially related work creation: kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 kvfree_call_rcu+0xae/0x7e0 kernel/rcu/tree.c:3648 neigh_destroy+0x44f/0x590 net/core/neighbour.c:860 neigh_release include/net/neighbour.h:427 [inline] neigh_cleanup_and_release+0x76/0x1a0 net/core/neighbour.c:103 neigh_del net/core/neighbour.c:197 [inline] neigh_remove_one+0x379/0x400 net/core/neighbour.c:218 neigh_forced_gc net/core/neighbour.c:251 [inline] neigh_alloc net/core/neighbour.c:429 [inline] ___neigh_create+0x492/0x1be0 net/core/neighbour.c:591 __neigh_create+0x31/0x40 net/core/neighbour.c:679 ip6_finish_output2+0xab3/0x1760 net/ipv6/ip6_output.c:127 __ip6_finish_output+0x61e/0x7d0 net/ipv6/ip6_output.c:201 ip6_finish_output+0x31/0x240 net/ipv6/ip6_output.c:211 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0x1d1/0x3b0 net/ipv6/ip6_output.c:234 dst_output include/net/dst.h:453 [inline] NF_HOOK include/linux/netfilter.h:305 [inline] ndisc_send_skb+0x797/0xc70 net/ipv6/ndisc.c:513 ndisc_send_rs+0x6e5/0x960 net/ipv6/ndisc.c:707 addrconf_rs_timer+0x2c7/0x600 net/ipv6/addrconf.c:3980 call_timer_fn+0x38/0x290 kernel/time/timer.c:1457 expire_timers kernel/time/timer.c:1502 [inline] __run_timers+0x639/0x9a0 kernel/time/timer.c:1773 run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1786 handle_softirqs+0x250/0x560 kernel/softirq.c:583 __do_softirq kernel/softirq.c:621 [inline] invoke_softirq kernel/softirq.c:443 [inline] __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:670 irq_exit_rcu+0x9/0x10 kernel/softirq.c:682 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline] sysvec_apic_timer_interrupt+0xa9/0xc0 arch/x86/kernel/apic/apic.c:1108 asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:676 The buggy address belongs to the object at ffff8881354d5c00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes inside of 512-byte region [ffff8881354d5c00, ffff8881354d5e00) The buggy address belongs to the page: page:ffffea0004d53500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1354d4 head:ffffea0004d53500 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 0000000000000000 0000000600000001 ffff888100042f00 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 2676, ts 717805484086, free_ts 717708570883 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1c/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485 __alloc_pages+0x18f/0x440 mm/page_alloc.c:5808 alloc_slab_page mm/slub.c:-1 [inline] allocate_slab mm/slub.c:1937 [inline] new_slab+0xa1/0x4d0 mm/slub.c:2000 ___slab_alloc+0x381/0x810 mm/slub.c:3033 __slab_alloc+0x49/0x90 mm/slub.c:3120 slab_alloc_node mm/slub.c:3211 [inline] slab_alloc mm/slub.c:3255 [inline] __kmalloc+0x16a/0x2c0 mm/slub.c:4432 kmalloc include/linux/slab.h:624 [inline] kzalloc include/linux/slab.h:750 [inline] neigh_alloc net/core/neighbour.c:438 [inline] ___neigh_create+0x6f2/0x1be0 net/core/neighbour.c:591 __neigh_create+0x31/0x40 net/core/neighbour.c:679 ip6_finish_output2+0xab3/0x1760 net/ipv6/ip6_output.c:127 __ip6_finish_output+0x61e/0x7d0 net/ipv6/ip6_output.c:201 ip6_finish_output+0x31/0x240 net/ipv6/ip6_output.c:211 NF_HOOK_COND include/linux/netfilter.h:294 [inline] ip6_output+0x1d1/0x3b0 net/ipv6/ip6_output.c:234 dst_output include/net/dst.h:453 [inline] NF_HOOK include/linux/netfilter.h:305 [inline] ndisc_send_skb+0x797/0xc70 net/ipv6/ndisc.c:513 ndisc_send_rs+0x6e5/0x960 net/ipv6/ndisc.c:707 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534 free_unref_page+0xa2/0x550 mm/page_alloc.c:3616 free_the_page mm/page_alloc.c:805 [inline] __free_pages+0x6c/0x100 mm/page_alloc.c:5884 free_nonslab_page+0x86/0xc0 mm/slub.c:3564 kfree+0x19a/0x270 mm/slub.c:4585 kvfree+0x35/0x40 mm/util.c:661 bpf_check+0x97b4/0xf280 kernel/bpf/verifier.c:14233 bpf_prog_load+0x1042/0x1550 kernel/bpf/syscall.c:2328 __sys_bpf+0x4c3/0x730 kernel/bpf/syscall.c:4633 __do_sys_bpf kernel/bpf/syscall.c:4737 [inline] __se_sys_bpf kernel/bpf/syscall.c:4735 [inline] __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4735 x64_sys_call+0x4b9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:322 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Memory state around the buggy address: ffff8881354d5b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881354d5b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881354d5c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881354d5c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881354d5d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 1 PID: 3695 at lib/refcount.c:28 refcount_warn_saturate+0x120/0x1a0 lib/refcount.c:28 Modules linked in: CPU: 1 PID: 3695 Comm: kworker/u4:2 Tainted: G B W syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025 Workqueue: l2tp l2tp_tunnel_del_work RIP: 0010:refcount_warn_saturate+0x120/0x1a0 lib/refcount.c:28 Code: 04 01 48 c7 c7 00 0b 63 85 e8 3c bc 53 02 0f 0b eb c3 e8 f3 9d 1c ff c6 05 5e ec 99 04 01 48 c7 c7 60 0b 63 85 e8 20 bc 53 02 <0f> 0b eb a7 e8 d7 9d 1c ff c6 05 3f ec 99 04 01 48 c7 c7 a0 0a 63 RSP: 0018:ffffc90000b27c38 EFLAGS: 00010246 RAX: 81cc026075fb6e00 RBX: 0000000000000003 RCX: ffff88814f51e2c0 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffffc90000b27c48 R08: dffffc0000000000 R09: ffffed103ee265e8 R10: ffffed103ee265e8 R11: 1ffff1103ee265e7 R12: ffff888128f19820 R13: dffffc0000000000 R14: 0000000000000003 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: fffffffffffffffd CR3: 000000012790b000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __refcount_sub_and_test include/linux/refcount.h:283 [inline] __refcount_dec_and_test include/linux/refcount.h:315 [inline] refcount_dec_and_test include/linux/refcount.h:333 [inline] l2tp_session_dec_refcount+0xc8/0x1a0 net/l2tp/l2tp_core.c:204 l2tp_session_delete+0x3ab/0x4a0 net/l2tp/l2tp_core.c:1572 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1218 [inline] l2tp_tunnel_del_work+0x1d2/0x3e0 net/l2tp/l2tp_core.c:1258 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472 kthread+0x411/0x500 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 ---[ end trace c4e164bc565a3116 ]---