KASAN: use-after-free Write in l2tp_session_get_nth

Status: premoderation: reported on 2026/11/22 10:38
Reported-by: syzbot+3e7d5282a25e511f984e@syzkaller.appspotmail.com
First crash: 2h23m, last: 2h23m
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Write in l2tp_session_get_nth 22 1 71d 71d 0/2 premoderation: reported on 2026/09/12 06:57

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline]
BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline]
BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline]
BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline]
BUG: KASAN: use-after-free in l2tp_session_inc_refcount net/l2tp/l2tp_core.c:211 [inline]
BUG: KASAN: use-after-free in l2tp_session_get_nth+0xe0/0x170 net/l2tp/l2tp_core.c:313
Write of size 4 at addr ffff888140493c88 by task syz.1.2034/17589

CPU: 0 PID: 17589 Comm: syz.1.2034 Tainted: G        W         syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x100/0x140 mm/kasan/report.c:452
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x249/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]
 atomic_fetch_add_relaxed include/asm-generic/atomic-instrumented.h:142 [inline]
 __refcount_add include/linux/refcount.h:193 [inline]
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 l2tp_session_inc_refcount net/l2tp/l2tp_core.c:211 [inline]
 l2tp_session_get_nth+0xe0/0x170 net/l2tp/l2tp_core.c:313
 pppol2tp_next_session net/l2tp/l2tp_ppp.c:1452 [inline]
 pppol2tp_seq_start+0x2a4/0x620 net/l2tp/l2tp_ppp.c:1481
 seq_read_iter+0x3b2/0xce0 fs/seq_file.c:225
 seq_read+0x3d9/0x4f0 fs/seq_file.c:162
 pde_read fs/proc/inode.c:321 [inline]
 proc_reg_read+0x1c4/0x2b0 fs/proc/inode.c:333
 vfs_read+0x209/0xa50 fs/read_write.c:494
 ksys_read+0x14a/0x260 fs/read_write.c:634
 __do_sys_read fs/read_write.c:644 [inline]
 __se_sys_read fs/read_write.c:642 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:642
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fcdf2690559
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcdf10de028 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007fcdf290cfa0 RCX: 00007fcdf2690559
RDX: 0000000000001000 RSI: 0000200000000340 RDI: 0000000000000006
RBP: 00007fcdf271f136 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fcdf290d038 R14: 00007fcdf290cfa0 R15: 00007ffc7900b5c8

Allocated by task 17589:
 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:430 [inline]
 ____kasan_kmalloc mm/kasan/common.c:509 [inline]
 __kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x19f/0x330 mm/slub.c:4038
 kmalloc include/linux/slab.h:560 [inline]
 kzalloc include/linux/slab.h:667 [inline]
 l2tp_session_create+0x39/0xb60 net/l2tp/l2tp_core.c:1616
 pppol2tp_connect+0xbf5/0x1640 net/l2tp/l2tp_ppp.c:772
 __sys_connect_file net/socket.c:1867 [inline]
 __sys_connect+0x3ce/0x450 net/socket.c:1884
 __do_sys_connect net/socket.c:1894 [inline]
 __se_sys_connect net/socket.c:1891 [inline]
 __x64_sys_connect+0x7a/0x90 net/socket.c:1891
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 17589:
 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:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1600 [inline]
 slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626
 slab_free mm/slub.c:3208 [inline]
 kfree+0xc0/0x270 mm/slub.c:4196
 l2tp_session_free net/l2tp/l2tp_core.c:168 [inline]
 l2tp_session_put+0xb2/0x1a0 net/l2tp/l2tp_core.c:193
 pppol2tp_ioctl+0x748/0x960 net/l2tp/l2tp_ppp.c:-1
 pppox_ioctl+0x1e1/0x440 drivers/net/ppp/pppox.c:110
 sock_do_ioctl+0xda/0x380 net/socket.c:1068
 sock_ioctl+0x472/0x740 net/socket.c:1208
 vfs_ioctl fs/ioctl.c:48 [inline]
 __do_sys_ioctl fs/ioctl.c:753 [inline]
 __se_sys_ioctl+0x121/0x1a0 fs/ioctl.c:739
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888140493c00
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 136 bytes inside of
 512-byte region [ffff888140493c00, ffff888140493e00)
The buggy address belongs to the page:
page:ffffea0005012400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x140490
head:ffffea0005012400 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100043080
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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 137, ts 306921848155, free_ts 306921353901
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x176/0x190 mm/page_alloc.c:2462
 get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1813 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1874
 new_slab_objects mm/slub.c:2632 [inline]
 ___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796
 __slab_alloc+0x63/0xa0 mm/slub.c:2836
 slab_alloc_node mm/slub.c:2918 [inline]
 slab_alloc mm/slub.c:2960 [inline]
 __kmalloc_track_caller+0x1e4/0x310 mm/slub.c:4541
 __kmalloc_reserve net/core/skbuff.c:144 [inline]
 __alloc_skb+0xdc/0x520 net/core/skbuff.c:212
 alloc_skb include/linux/skbuff.h:1126 [inline]
 alloc_skb_with_frags+0xa3/0x560 net/core/skbuff.c:6058
 sock_alloc_send_pskb+0x87f/0x9a0 net/core/sock.c:2392
 unix_dgram_sendmsg+0x6f3/0x18f0 net/unix/af_unix.c:1725
 unix_seqpacket_sendmsg+0x118/0x1e0 net/unix/af_unix.c:2108
 sock_sendmsg_nosec net/socket.c:652 [inline]
 __sock_sendmsg net/socket.c:664 [inline]
 sock_write_iter+0x2a6/0x3a0 net/socket.c:1019
 do_iter_readv_writev+0x477/0x5f0 fs/read_write.c:-1
 do_iter_write+0x175/0x5e0 fs/read_write.c:866
 vfs_writev+0x2a9/0x530 fs/read_write.c:939
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 __free_pages_ok+0x80b/0x830 mm/page_alloc.c:1629
 free_the_page mm/page_alloc.c:5445 [inline]
 __free_pages+0xd8/0x390 mm/page_alloc.c:5454
 kfree+0x1e4/0x270 mm/slub.c:4193
 skb_free_head net/core/skbuff.c:606 [inline]
 skb_release_data+0x53b/0x690 net/core/skbuff.c:626
 skb_release_all net/core/skbuff.c:680 [inline]
 __kfree_skb net/core/skbuff.c:694 [inline]
 consume_skb+0xab/0x1f0 net/core/skbuff.c:855
 skb_free_datagram+0x28/0xe0 net/core/datagram.c:325
 netlink_recvmsg+0x5dd/0xe60 net/netlink/af_netlink.c:2006
 ____sys_recvmsg+0x2ca/0x5b0 net/socket.c:-1
 ___sys_recvmsg+0x213/0x5c0 net/socket.c:2638
 __sys_recvmsg net/socket.c:2668 [inline]
 __do_sys_recvmsg net/socket.c:2678 [inline]
 __se_sys_recvmsg net/socket.c:2675 [inline]
 __x64_sys_recvmsg+0x1fe/0x2d0 net/socket.c:2675
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff888140493b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888140493c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888140493c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888140493d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888140493d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
------------[ cut here ]------------
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 17589 at lib/refcount.c:25 refcount_warn_saturate+0x104/0x1a0 lib/refcount.c:25
Modules linked in:
CPU: 0 PID: 17589 Comm: syz.1.2034 Tainted: G    B   W         syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:refcount_warn_saturate+0x104/0x1a0 lib/refcount.c:25
Code: 04 01 48 c7 c7 40 54 40 85 e8 28 58 3f 02 0f 0b eb df e8 8f 76 26 ff c6 05 dd fa 82 04 01 48 c7 c7 80 53 40 85 e8 0c 58 3f 02 <0f> 0b eb c3 e8 73 76 26 ff c6 05 c2 fa 82 04 01 48 c7 c7 e0 53 40
RSP: 0018:ffffc900019e7980 EFLAGS: 00010246
RAX: b6c8d5041d343e00 RBX: 0000000000000002 RCX: 0000000000080000
RDX: ffffc9000693d000 RSI: 0000000000063ef1 RDI: 0000000000063ef2
RBP: ffffc900019e7990 R08: ffffc900019e7307 R09: fffff5200033ce94
R10: dffffc0000000000 R11: fffff5200033ce61 R12: 0000000000000000
R13: 0000000000000001 R14: 0000000000000002 R15: ffff888140493c88
FS:  00007fcdf10de6c0(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fce0da92fd0 CR3: 000000012f929000 CR4: 00000000003526b0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __refcount_add include/linux/refcount.h:-1 [inline]
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 l2tp_session_inc_refcount net/l2tp/l2tp_core.c:211 [inline]
 l2tp_session_get_nth+0x167/0x170 net/l2tp/l2tp_core.c:313
 pppol2tp_next_session net/l2tp/l2tp_ppp.c:1452 [inline]
 pppol2tp_seq_start+0x2a4/0x620 net/l2tp/l2tp_ppp.c:1481
 seq_read_iter+0x3b2/0xce0 fs/seq_file.c:225
 seq_read+0x3d9/0x4f0 fs/seq_file.c:162
 pde_read fs/proc/inode.c:321 [inline]
 proc_reg_read+0x1c4/0x2b0 fs/proc/inode.c:333
 vfs_read+0x209/0xa50 fs/read_write.c:494
 ksys_read+0x14a/0x260 fs/read_write.c:634
 __do_sys_read fs/read_write.c:644 [inline]
 __se_sys_read fs/read_write.c:642 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:642
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fcdf2690559
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fcdf10de028 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007fcdf290cfa0 RCX: 00007fcdf2690559
RDX: 0000000000001000 RSI: 0000200000000340 RDI: 0000000000000006
RBP: 00007fcdf271f136 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fcdf290d038 R14: 00007fcdf290cfa0 R15: 00007ffc7900b5c8
---[ end trace 90e91eb82ef2f98a ]---
------------[ cut here ]------------
WARNING: CPU: 0 PID: 17589 at net/l2tp/l2tp_ppp.c:156 pppol2tp_sock_to_session+0x167/0x1b0 net/l2tp/l2tp_ppp.c:156
Modules linked in:
CPU: 0 PID: 17589 Comm: syz.1.2034 Tainted: G    B   W         syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:pppol2tp_sock_to_session+0x167/0x1b0 net/l2tp/l2tp_ppp.c:156
Code: 5d c3 e8 7c 6a 31 fd be 02 00 00 00 eb 0a e8 70 6a 31 fd be 01 00 00 00 4c 89 f7 e8 e3 f2 0a fe e9 0f ff ff ff e8 59 6a 31 fd <0f> 0b 48 89 df e8 ef 00 00 00 eb bd e8 48 6a 31 fd 4c 89 f7 be 03
RSP: 0000:ffffc900019e78e0 EFLAGS: 00010293
RAX: ffffffff84335197 RBX: ffff88811ed0e000 RCX: ffff88813ff9e400
RDX: 0000000000000000 RSI: 00000000083fd040 RDI: 000000000c04eb7d
RBP: ffffc900019e7900 R08: ffff88811ed0e083 R09: 1ffff11023da1c10
R10: dffffc0000000000 R11: ffffed1023da1c11 R12: dffffc0000000000
R13: dffffc0000000000 R14: 00000000083fd040 R15: ffff888140493c00
FS:  0000000000000000(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fcc23b74368 CR3: 000000010d51d000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 pppol2tp_release+0x150/0x2b0 net/l2tp/l2tp_ppp.c:435
 __sock_release net/socket.c:597 [inline]
 sock_close+0xb8/0x200 net/socket.c:1287
 __fput+0x2dc/0x730 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x127/0x190 kernel/task_work.c:189
 exit_task_work include/linux/task_work.h:33 [inline]
 do_exit+0xa7c/0x24e0 kernel/exit.c:879
 do_group_exit+0x149/0x310 kernel/exit.c:993
 get_signal+0xfb1/0x1300 kernel/signal.c:2806
 arch_do_signal_or_restart+0xe7/0x11b0 arch/x86/kernel/signal.c:805
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xa2/0xe0 kernel/entry/common.c:172
 exit_to_user_mode_prepare+0x76/0xa0 kernel/entry/common.c:202
 syscall_exit_to_user_mode+0x1d/0x40 kernel/entry/common.c:277
 do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fcdf2690559
Code: Unable to access opcode bytes at RIP 0x7fcdf269052f.
RSP: 002b:00007fcdf10de0e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007fcdf290cfa8 RCX: 00007fcdf2690559
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007fcdf290cfa8
RBP: 00007fcdf290cfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fcdf290d038 R14: 00007ffc7900b4e0 R15: 00007ffc7900b5c8
---[ end trace 90e91eb82ef2f98b ]---

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/22 10:37 android13-5.10-lts cff3ede94a35 b2c69459 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in l2tp_session_get_nth
* Struck through repros no longer work on HEAD.