================================================================== 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/0x4e0 net/l2tp/l2tp_core.c:1563 Write of size 8 at addr ffff888133430c08 by task kworker/u4:9/2355 CPU: 0 PID: 2355 Comm: kworker/u4:9 Not tainted 5.15.167-syzkaller-00348-g2e66050fb753 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Workqueue: l2tp l2tp_tunnel_del_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 kasan_check_range+0x293/0x2a0 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/0x4e0 net/l2tp/l2tp_core.c:1563 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1218 [inline] l2tp_tunnel_del_work+0x19d/0x380 net/l2tp/l2tp_core.c:1258 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 3883: 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+0xdb/0x110 mm/kasan/common.c:512 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521 kasan_kmalloc include/linux/kasan.h:227 [inline] __kmalloc+0x13a/0x270 mm/slub.c:4427 kmalloc include/linux/slab.h:608 [inline] kzalloc include/linux/slab.h:733 [inline] l2tp_session_create+0x38/0xb60 net/l2tp/l2tp_core.c:1599 pppol2tp_connect+0xc5d/0x1690 net/l2tp/l2tp_ppp.c:782 __sys_connect_file net/socket.c:1918 [inline] __sys_connect+0x38b/0x410 net/socket.c:1935 __do_sys_connect net/socket.c:1945 [inline] __se_sys_connect net/socket.c:1942 [inline] __x64_sys_connect+0x7a/0x90 net/socket.c:1942 x64_sys_call+0x14e/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:43 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 3904: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x126/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:1723 [inline] slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749 slab_free mm/slub.c:3519 [inline] kfree+0xc8/0x220 mm/slub.c:4579 l2tp_session_free net/l2tp/l2tp_core.c:168 [inline] l2tp_session_dec_refcount+0xa9/0x1b0 net/l2tp/l2tp_core.c:205 pppol2tp_session_destruct+0xaf/0xf0 net/l2tp/l2tp_ppp.c:419 __sk_destruct+0x56/0x5b0 net/core/sock.c:1961 sk_destruct net/core/sock.c:2006 [inline] __sk_free+0x36c/0x470 net/core/sock.c:2017 sk_free+0x51/0x80 net/core/sock.c:2028 sock_put include/net/sock.h:1921 [inline] pppol2tp_put_sk+0x77/0xb0 net/l2tp/l2tp_ppp.c:402 rcu_do_batch+0x57a/0xc10 kernel/rcu/tree.c:2523 rcu_core+0x517/0x1020 kernel/rcu/tree.c:2763 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2776 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565 __do_softirq kernel/softirq.c:603 [inline] invoke_softirq kernel/softirq.c:425 [inline] __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:652 irq_exit_rcu+0x9/0x10 kernel/softirq.c:664 sysvec_apic_timer_interrupt+0x49/0xc0 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:638 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 __call_rcu_common kernel/rcu/tree.c:3007 [inline] call_rcu+0x123/0x10b0 kernel/rcu/tree.c:3125 pppol2tp_release+0x20f/0x2d0 net/l2tp/l2tp_ppp.c:458 __sock_release net/socket.c:649 [inline] sock_close+0xdf/0x270 net/socket.c:1336 __fput+0x228/0x8c0 fs/file_table.c:280 ____fput+0x15/0x20 fs/file_table.c:308 task_work_run+0x129/0x190 kernel/task_work.c:188 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0xc48/0x2ca0 kernel/exit.c:880 do_group_exit+0x141/0x310 kernel/exit.c:1002 get_signal+0x7a3/0x1630 kernel/signal.c:2904 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:154 [inline] exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:178 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:307 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358 __call_rcu_common kernel/rcu/tree.c:3007 [inline] call_rcu+0x123/0x10b0 kernel/rcu/tree.c:3125 fib6_info_release include/net/ip6_fib.h:349 [inline] __ip6_del_rt+0xf3/0x140 net/ipv6/route.c:3899 ip6_del_rt+0xdd/0x130 net/ipv6/route.c:3910 __ipv6_ifa_notify+0xa09/0x11c0 net/ipv6/addrconf.c:6221 addrconf_ifdown+0xe14/0x1ae0 net/ipv6/addrconf.c:3922 addrconf_notify+0x37d/0xdd0 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:391 call_netdevice_notifiers_info net/core/dev.c:2026 [inline] call_netdevice_notifiers_extack net/core/dev.c:2038 [inline] call_netdevice_notifiers net/core/dev.c:2052 [inline] dev_close_many+0x37c/0x530 net/core/dev.c:1627 unregister_netdevice_many+0x492/0x17c0 net/core/dev.c:11086 default_device_exit_batch+0x38a/0x3f0 net/core/dev.c:11643 ops_exit_list net/core/net_namespace.c:177 [inline] cleanup_net+0x6ce/0xc00 net/core/net_namespace.c:599 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 The buggy address belongs to the object at ffff888133430c00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes inside of 512-byte region [ffff888133430c00, ffff888133430e00) The buggy address belongs to the page: page:ffffea0004cd0c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888133431400 pfn:0x133430 head:ffffea0004cd0c00 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 ffffea000492b908 ffffea0004404508 ffff888100042f00 raw: ffff888133431400 000000000010000b 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 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 20, ts 24747517659, free_ts 0 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779 allocate_slab mm/slub.c:1932 [inline] new_slab+0x9a/0x4e0 mm/slub.c:1995 ___slab_alloc+0x39e/0x830 mm/slub.c:3028 __slab_alloc+0x4a/0x90 mm/slub.c:3115 slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3248 [inline] __kmalloc_track_caller+0x16c/0x260 mm/slub.c:4945 kmalloc_reserve net/core/skbuff.c:357 [inline] __alloc_skb+0x10c/0x550 net/core/skbuff.c:428 alloc_skb include/linux/skbuff.h:1183 [inline] ndisc_alloc_skb+0xf3/0x2d0 net/ipv6/ndisc.c:423 ndisc_send_ns+0x29d/0x830 net/ipv6/ndisc.c:629 addrconf_dad_work+0xb29/0x1710 net/ipv6/addrconf.c:4221 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 page_owner free stack trace missing Memory state around the buggy address: ffff888133430b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888133430b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888133430c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888133430c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888133430d00: 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: 2355 at lib/refcount.c:28 refcount_warn_saturate+0x158/0x1a0 lib/refcount.c:28 Modules linked in: CPU: 1 PID: 2355 Comm: kworker/u4:9 Tainted: G B 5.15.167-syzkaller-00348-g2e66050fb753 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Workqueue: l2tp l2tp_tunnel_del_work RIP: 0010:refcount_warn_saturate+0x158/0x1a0 lib/refcount.c:28 Code: 04 01 48 c7 c7 c0 08 a3 85 e8 84 e6 db fe 0f 0b eb 8b e8 4b 9c 0a ff c6 05 55 ca c0 04 01 48 c7 c7 20 09 a3 85 e8 68 e6 db fe <0f> 0b e9 6c ff ff ff e8 2c 9c 0a ff c6 05 37 ca c0 04 01 48 c7 c7 RSP: 0018:ffffc90000c3fc20 EFLAGS: 00010246 RAX: 930e2a083b98d400 RBX: 0000000000000003 RCX: ffff888110f72780 RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000 RBP: ffffc90000c3fc30 R08: ffffffff81579195 R09: ffffed103ee24e93 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888133431020 R13: ffff888133431000 R14: 0000000000000003 R15: ffff888133430c88 FS: 0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000558140358000 CR3: 000000010ccf1000 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+0xc4/0x1b0 net/l2tp/l2tp_core.c:204 l2tp_session_delete+0x3bc/0x4e0 net/l2tp/l2tp_core.c:1572 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1218 [inline] l2tp_tunnel_del_work+0x19d/0x380 net/l2tp/l2tp_core.c:1258 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472 kthread+0x421/0x510 kernel/kthread.c:337 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 ---[ end trace 480f1d195383fe9f ]---