==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
BUG: KASAN: use-after-free in test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:71 [inline]
BUG: KASAN: use-after-free in l2tp_session_delete+0x27/0x520 net/l2tp/l2tp_core.c:1561
Write of size 8 at addr ffff888124616808 by task kworker/u4:4/398
CPU: 0 PID: 398 Comm: kworker/u4:4 Not tainted 6.1.112-syzkaller-00026-g51bee181735e #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/0x1b7 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:316 [inline]
print_report+0x158/0x4e0 mm/kasan/report.c:427
kasan_report+0x13c/0x170 mm/kasan/report.c:531
kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189
__kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
instrument_atomic_read_write include/linux/instrumented.h:102 [inline]
test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:71 [inline]
l2tp_session_delete+0x27/0x520 net/l2tp/l2tp_core.c:1561
l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1216 [inline]
l2tp_tunnel_del_work+0x1f8/0x400 net/l2tp/l2tp_core.c:1256
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Allocated by task 24223:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:379 [inline]
__kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
kasan_kmalloc include/linux/kasan.h:212 [inline]
__do_kmalloc_node mm/slab_common.c:938 [inline]
__kmalloc+0xb4/0x1e0 mm/slab_common.c:951
kmalloc include/linux/slab.h:562 [inline]
kzalloc include/linux/slab.h:693 [inline]
l2tp_session_create+0x38/0xbe0 net/l2tp/l2tp_core.c:1597
pppol2tp_connect+0xc5d/0x1690 net/l2tp/l2tp_ppp.c:781
__sys_connect_file net/socket.c:1996 [inline]
__sys_connect+0x2c9/0x300 net/socket.c:2013
__do_sys_connect net/socket.c:2023 [inline]
__se_sys_connect net/socket.c:2020 [inline]
__x64_sys_connect+0x7a/0x90 net/socket.c:2020
x64_sys_call+0x14e/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:43
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Freed by task 19936:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
kasan_slab_free include/linux/kasan.h:178 [inline]
slab_free_hook mm/slub.c:1745 [inline]
slab_free_freelist_hook mm/slub.c:1771 [inline]
slab_free mm/slub.c:3686 [inline]
__kmem_cache_free+0x21d/0x410 mm/slub.c:3702
kfree+0x7a/0xf0 mm/slab_common.c:990
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:418
__sk_destruct+0x56/0x5c0 net/core/sock.c:2145
sk_destruct net/core/sock.c:2190 [inline]
__sk_free+0x36c/0x470 net/core/sock.c:2201
sk_free+0x51/0x80 net/core/sock.c:2212
sock_put include/net/sock.h:2041 [inline]
pppol2tp_put_sk+0x77/0xb0 net/l2tp/l2tp_ppp.c:401
rcu_do_batch+0x552/0xbe0 kernel/rcu/tree.c:2297
rcu_core+0x4ee/0xf10 kernel/rcu/tree.c:2557
rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2574
handle_softirqs+0x1db/0x650 kernel/softirq.c:617
__do_softirq+0xb/0xd kernel/softirq.c:655
Last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
__call_rcu_common kernel/rcu/tree.c:2807 [inline]
call_rcu+0xdc/0x10f0 kernel/rcu/tree.c:2926
pppol2tp_release+0x20f/0x2d0 net/l2tp/l2tp_ppp.c:457
__sock_release net/socket.c:652 [inline]
sock_close+0xdf/0x270 net/socket.c:1390
__fput+0x1e5/0x870 fs/file_table.c:320
____fput+0x15/0x20 fs/file_table.c:348
task_work_run+0x24d/0x2e0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
Second to last potentially related work creation:
kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
__kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
__call_rcu_common kernel/rcu/tree.c:2807 [inline]
call_rcu+0xdc/0x10f0 kernel/rcu/tree.c:2926
pppol2tp_release+0x20f/0x2d0 net/l2tp/l2tp_ppp.c:457
__sock_release net/socket.c:652 [inline]
sock_close+0xdf/0x270 net/socket.c:1390
__fput+0x1e5/0x870 fs/file_table.c:320
____fput+0x15/0x20 fs/file_table.c:348
task_work_run+0x24d/0x2e0 kernel/task_work.c:203
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0x94/0xa0 kernel/entry/common.c:177
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87
entry_SYSCALL_64_after_hwframe+0x68/0xd2
The buggy address belongs to the object at ffff888124616800
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
512-byte region [ffff888124616800, ffff888124616a00)
The buggy address belongs to the physical page:
page:ffffea0004918500 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x124614
head:ffffea0004918500 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 dead000000000001 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 375, tgid 375 (syz-executor), ts 38873047494, free_ts 36889031344
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
get_page_from_freelist+0x2980/0x2a10 mm/page_alloc.c:4439
__alloc_pages+0x234/0x610 mm/page_alloc.c:5728
alloc_slab_page+0x6c/0xf0
allocate_slab mm/slub.c:1962 [inline]
new_slab+0x90/0x3e0 mm/slub.c:2015
___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
__slab_alloc+0x5d/0xa0 mm/slub.c:3302
slab_alloc_node mm/slub.c:3387 [inline]
__kmem_cache_alloc_node+0x207/0x2a0 mm/slub.c:3462
__do_kmalloc_node mm/slab_common.c:937 [inline]
__kmalloc+0xa3/0x1e0 mm/slab_common.c:951
kmalloc include/linux/slab.h:562 [inline]
kzalloc include/linux/slab.h:693 [inline]
fib6_info_alloc+0x33/0xe0 net/ipv6/ip6_fib.c:156
ip6_route_info_create+0x50b/0x14c0 net/ipv6/route.c:3757
ip6_route_add+0x27/0x130 net/ipv6/route.c:3851
addrconf_prefix_route net/ipv6/addrconf.c:2465 [inline]
fixup_permanent_addr net/ipv6/addrconf.c:3549 [inline]
addrconf_permanent_addr+0x757/0xba0 net/ipv6/addrconf.c:3573
addrconf_notify+0x7c2/0xe10 net/ipv6/addrconf.c:3645
notifier_call_chain kernel/notifier.c:87 [inline]
raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455
page last free stack trace:
reset_page_owner include/linux/page_owner.h:26 [inline]
free_pages_prepare mm/page_alloc.c:1498 [inline]
free_pcp_prepare mm/page_alloc.c:1572 [inline]
free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3511
free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3607
free_the_page mm/page_alloc.c:798 [inline]
__free_pages+0x61/0xf0 mm/page_alloc.c:5817
__vunmap+0x9f3/0xb60 mm/vmalloc.c:2728
__vfree mm/vmalloc.c:2776 [inline]
vfree+0x5c/0x80 mm/vmalloc.c:2807
kcov_put kernel/kcov.c:437 [inline]
kcov_close+0x2b/0x50 kernel/kcov.c:533
__fput+0x1e5/0x870 fs/file_table.c:320
____fput+0x15/0x20 fs/file_table.c:348
task_work_run+0x24d/0x2e0 kernel/task_work.c:203
exit_task_work include/linux/task_work.h:39 [inline]
do_exit+0xbd5/0x2b80 kernel/exit.c:877
do_group_exit+0x21a/0x2d0 kernel/exit.c:1027
get_signal+0x169d/0x1820 kernel/signal.c:2888
arch_do_signal_or_restart+0xb0/0x16f0 arch/x86/kernel/signal.c:871
exit_to_user_mode_loop+0x74/0xa0 kernel/entry/common.c:174
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:303
Memory state around the buggy address:
ffff888124616700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff888124616780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888124616800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888124616880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888124616900: 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: 0 PID: 398 at lib/refcount.c:28 refcount_warn_saturate+0x158/0x1a0 lib/refcount.c:28
Modules linked in:
CPU: 0 PID: 398 Comm: kworker/u4:4 Tainted: G B 6.1.112-syzkaller-00026-g51bee181735e #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: 05 01 48 c7 c7 a0 b4 e9 85 e8 64 35 cd fe 0f 0b eb 8b e8 6b 32 fe fe c6 05 fb 18 18 05 01 48 c7 c7 00 b5 e9 85 e8 48 35 cd fe <0f> 0b e9 6c ff ff ff e8 4c 32 fe fe c6 05 dd 18 18 05 01 48 c7 c7
RSP: 0018:ffffc90000a17c18 EFLAGS: 00010246
RAX: 5408319ecb981e00 RBX: 0000000000000003 RCX: ffff8881174be540
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffffc90000a17c28 R08: ffffffff8144ab2e R09: fffff52000142edd
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff888124616880
R13: ffff888124616800 R14: 0000000000000003 R15: ffff888124616888
FS: 0000000000000000(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000980 CR3: 0000000121c56000 CR4: 00000000003506b0
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+0x407/0x520 net/l2tp/l2tp_core.c:1570
l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1216 [inline]
l2tp_tunnel_del_work+0x1f8/0x400 net/l2tp/l2tp_core.c:1256
process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
kthread+0x26d/0x300 kernel/kthread.c:386
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
---[ end trace 0000000000000000 ]---
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_bridge: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): bridge_slave_0: link becomes ready
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered forwarding state
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_bridge: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): bridge_slave_1: link becomes ready
bridge0: port 2(bridge_slave_1) entered blocking state
bridge0: port 2(bridge_slave_1) entered forwarding state
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_hsr: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): hsr_slave_0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_hsr: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): hsr_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_virt_wifi: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_virt_wifi: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_vlan: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_vlan: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vlan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vlan1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_macvtap: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_macvtap: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_batadv: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
device bridge_slave_1 left promiscuous mode
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_0 left promiscuous mode
bridge0: port 1(bridge_slave_0) entered disabled state
device veth1_macvtap left promiscuous mode
device veth0_vlan left promiscuous mode