================================================================== 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:1550 Write of size 8 at addr ffff88812d0e7408 by task kworker/u4:9/7223 CPU: 1 PID: 7223 Comm: kworker/u4:9 Not tainted 6.1.99-syzkaller-00006-g80e851bf0d46 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/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:1550 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1205 [inline] l2tp_tunnel_del_work+0x1f8/0x400 net/l2tp/l2tp_core.c:1245 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:308 Allocated by task 8046: 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:957 [inline] __kmalloc+0xb4/0x1e0 mm/slab_common.c:970 kmalloc include/linux/slab.h:561 [inline] kzalloc include/linux/slab.h:692 [inline] l2tp_session_create+0x38/0xbe0 net/l2tp/l2tp_core.c:1586 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 13: 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:3684 [inline] __kmem_cache_free+0x218/0x3b0 mm/slub.c:3697 kfree+0x7a/0xf0 mm/slab_common.c:1009 l2tp_session_free net/l2tp/l2tp_core.c:163 [inline] l2tp_session_dec_refcount+0xa9/0x1b0 net/l2tp/l2tp_core.c:200 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+0x534/0xb80 kernel/rcu/tree.c:2296 rcu_core+0x4ee/0xf10 kernel/rcu/tree.c:2556 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2573 handle_softirqs+0x1db/0x650 kernel/softirq.c:617 run_ksoftirqd+0x28/0x30 kernel/softirq.c:994 smpboot_thread_fn+0x466/0x8d0 kernel/smpboot.c:164 kthread+0x26d/0x300 kernel/kthread.c:386 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 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:2806 [inline] call_rcu+0xee/0x1340 kernel/rcu/tree.c:2925 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:179 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:2806 [inline] call_rcu+0xee/0x1340 kernel/rcu/tree.c:2925 fib6_info_release include/net/ip6_fib.h:350 [inline] __ip6_del_rt+0xf3/0x140 net/ipv6/route.c:3878 ip6_del_rt+0xdd/0x130 net/ipv6/route.c:3889 __ipv6_ifa_notify+0x9dd/0x11a0 net/ipv6/addrconf.c:6235 addrconf_ifdown+0xe51/0x1ab0 net/ipv6/addrconf.c:3927 addrconf_notify+0x32f/0xe10 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:455 call_netdevice_notifiers_info net/core/dev.c:1978 [inline] call_netdevice_notifiers_extack net/core/dev.c:2016 [inline] call_netdevice_notifiers net/core/dev.c:2030 [inline] dev_close_many+0x37c/0x530 net/core/dev.c:1578 unregister_netdevice_many+0x4d1/0x1740 net/core/dev.c:10864 default_device_exit_batch+0x975/0xa00 net/core/dev.c:11403 ops_exit_list net/core/net_namespace.c:177 [inline] cleanup_net+0x6c9/0xbf0 net/core/net_namespace.c:604 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:308 The buggy address belongs to the object at ffff88812d0e7400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 8 bytes inside of 512-byte region [ffff88812d0e7400, ffff88812d0e7600) The buggy address belongs to the physical page: page:ffffea0004b43900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12d0e4 head:ffffea0004b43900 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 294, tgid 294 (syz-executor), ts 23199297998, free_ts 0 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+0x27ea/0x2870 mm/page_alloc.c:4425 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5714 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+0x1af/0x250 mm/slub.c:3460 __do_kmalloc_node mm/slab_common.c:956 [inline] __kmalloc_node_track_caller+0xa2/0x1e0 mm/slab_common.c:977 kmalloc_reserve net/core/skbuff.c:446 [inline] __alloc_skb+0x125/0x2d0 net/core/skbuff.c:515 alloc_skb include/linux/skbuff.h:1290 [inline] nlmsg_new include/net/netlink.h:991 [inline] netlink_ack+0x392/0x12a0 net/netlink/af_netlink.c:2455 netlink_rcv_skb+0x24a/0x410 net/netlink/af_netlink.c:2524 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6139 netlink_unicast_kernel net/netlink/af_netlink.c:1327 [inline] netlink_unicast+0x906/0xab0 net/netlink/af_netlink.c:1353 netlink_sendmsg+0xa15/0xd30 net/netlink/af_netlink.c:1875 page_owner free stack trace missing Memory state around the buggy address: ffff88812d0e7300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88812d0e7380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88812d0e7400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88812d0e7480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88812d0e7500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================