KASAN: use-after-free Read in l2tp_tunnel_get_session

Status: premoderation: reported on 2026/06/26 07:57
Reported-by: syzbot+c6fe0d9e1c90024903c0@syzkaller.appspotmail.com
First crash: 38d, last: 9d14h
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in l2tp_tunnel_get_session 19 2 10d 10d 0/2 premoderation: reported on 2026/07/23 21:14
android-5-10 KASAN: use-after-free Read in l2tp_tunnel_get_session 19 1 29d 29d 0/2 premoderation: reported on 2026/07/05 05:21

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in l2tp_tunnel_get_session+0xcd/0x170 net/l2tp/l2tp_core.c:270
Read of size 4 at addr ffff88811ae28418 by task syz.0.160/921

CPU: 1 PID: 921 Comm: syz.0.160 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0x110/0x170 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+0x10f/0x150 mm/kasan/report.c:444
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 l2tp_tunnel_get_session+0xcd/0x170 net/l2tp/l2tp_core.c:270
 pppol2tp_connect+0xb3c/0x1640 net/l2tp/l2tp_ppp.c:747
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x3cb/0x450 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
RIP: 0033:0x7f14f1f97e99
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:00007f14f09f1028 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f14f221ffa0 RCX: 00007f14f1f97e99
RDX: 0000000000000032 RSI: 0000200000000240 RDI: 0000000000000003
RBP: 00007f14f202deaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f14f2220038 R14: 00007f14f221ffa0 R15: 00007fff311df078
 </TASK>

Allocated by task 918:
 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+0xd4/0x100 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:1616
 pppol2tp_connect+0xbf5/0x1640 net/l2tp/l2tp_ppp.c:772
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x3cb/0x450 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 918:
 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_put+0xaf/0x1a0 net/l2tp/l2tp_core.c:193
 pppol2tp_ioctl+0x748/0x960 net/l2tp/l2tp_ppp.c:-1
 pppox_ioctl+0x1e4/0x320 drivers/net/ppp/pppox.c:93
 sock_do_ioctl+0x103/0x310 net/socket.c:1138
 sock_ioctl+0x459/0x6d0 net/socket.c:1257
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0x121/0x1a0 fs/ioctl.c:860
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:860
 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17
 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

The buggy address belongs to the object at ffff88811ae28400
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 24 bytes inside of
 512-byte region [ffff88811ae28400, ffff88811ae28600)
The buggy address belongs to the page:
page:ffffea00046b8a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11ae28
head:ffffea00046b8a00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 0000000100000001 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 140, ts 7596005022, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2607
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2613
 get_page_from_freelist+0x2c3a/0x2cd0 mm/page_alloc.c:4487
 __alloc_pages+0x1a2/0x460 mm/page_alloc.c:5824
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1937 [inline]
 new_slab+0xa0/0x4d0 mm/slub.c:2000
 ___slab_alloc+0x3ac/0x840 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_track_caller+0x169/0x2c0 mm/slub.c:4954
 kmalloc_reserve net/core/skbuff.c:357 [inline]
 __alloc_skb+0x210/0x730 net/core/skbuff.c:428
 alloc_skb include/linux/skbuff.h:1183 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1186 [inline]
 netlink_sendmsg+0x611/0xb80 net/netlink/af_netlink.c:1902
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 ____sys_sendmsg+0x5be/0x8f0 net/socket.c:2436
 ___sys_sendmsg+0x236/0x2e0 net/socket.c:2490
 __sys_sendmsg net/socket.c:2519 [inline]
 __do_sys_sendmsg net/socket.c:2528 [inline]
 __se_sys_sendmsg net/socket.c:2526 [inline]
 __x64_sys_sendmsg+0x201/0x2d0 net/socket.c:2526
 x64_sys_call+0x4b/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:47
 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
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88811ae28300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88811ae28380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88811ae28400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88811ae28480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811ae28500: 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: 1 PID: 921 at lib/refcount.c:25 refcount_warn_saturate+0x104/0x1a0 lib/refcount.c:25
Modules linked in:
CPU: 1 PID: 921 Comm: syz.0.160 Tainted: G    B             syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:refcount_warn_saturate+0x104/0x1a0 lib/refcount.c:25
Code: 04 01 48 c7 c7 80 47 63 85 e8 c8 47 5a 02 0f 0b eb df e8 5f 80 19 ff c6 05 1b ea 95 04 01 48 c7 c7 c0 46 63 85 e8 ac 47 5a 02 <0f> 0b eb c3 e8 43 80 19 ff c6 05 00 ea 95 04 01 48 c7 c7 20 47 63
RSP: 0018:ffffc900010e7ba8 EFLAGS: 00010246
RAX: b91f91087a8abd00 RBX: 0000000000000002 RCX: 0000000000080000
RDX: ffffc9000171c000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: ffffc900010e7bb8 R08: ffffc900010e7607 R09: 1ffff9200021cec0
R10: dffffc0000000000 R11: fffff5200021cec1 R12: 0000000000000000
R13: dffffc0000000000 R14: 0000000000000002 R15: ffff88811ae28488
FS:  00007f14f09f16c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000000240 CR3: 0000000135c90000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __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_tunnel_get_session+0x161/0x170 net/l2tp/l2tp_core.c:271
 pppol2tp_connect+0xb3c/0x1640 net/l2tp/l2tp_ppp.c:747
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x3cb/0x450 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
RIP: 0033:0x7f14f1f97e99
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:00007f14f09f1028 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f14f221ffa0 RCX: 00007f14f1f97e99
RDX: 0000000000000032 RSI: 0000200000000240 RDI: 0000000000000003
RBP: 00007f14f202deaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f14f2220038 R14: 00007f14f221ffa0 R15: 00007fff311df078
 </TASK>
---[ end trace c5f183b66fdb6f54 ]---
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 921 at lib/refcount.c:28 refcount_warn_saturate+0x120/0x1a0 lib/refcount.c:28
Modules linked in:
CPU: 0 PID: 921 Comm: syz.0.160 Tainted: G    B   W         syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
RIP: 0010:refcount_warn_saturate+0x120/0x1a0 lib/refcount.c:28
Code: 04 01 48 c7 c7 c0 46 63 85 e8 ac 47 5a 02 0f 0b eb c3 e8 43 80 19 ff c6 05 00 ea 95 04 01 48 c7 c7 20 47 63 85 e8 90 47 5a 02 <0f> 0b eb a7 e8 27 80 19 ff c6 05 e1 e9 95 04 01 48 c7 c7 60 46 63
RSP: 0018:ffffc900010e7bb8 EFLAGS: 00010246
RAX: b91f91087a8abd00 RBX: 0000000000000003 RCX: 0000000000080000
RDX: ffffc9000171c000 RSI: 000000000007ffff RDI: 0000000000080000
RBP: ffffc900010e7bc8 R08: ffff8881f7032f3f R09: 1ffff1103ee065e7
R10: dffffc0000000000 R11: ffffed103ee065e8 R12: ffff88811a647400
R13: 1ffff9200021cf8c R14: 0000000000000003 R15: 00000000c0000000
FS:  00007f14f09f16c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe14671b580 CR3: 0000000135c90000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 __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_put+0xc8/0x1a0 net/l2tp/l2tp_core.c:192
 pppol2tp_connect+0xa33/0x1640 net/l2tp/l2tp_ppp.c:843
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x3cb/0x450 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
RIP: 0033:0x7f14f1f97e99
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:00007f14f09f1028 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f14f221ffa0 RCX: 00007f14f1f97e99
RDX: 0000000000000032 RSI: 0000200000000240 RDI: 0000000000000003
RBP: 00007f14f202deaf R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f14f2220038 R14: 00007f14f221ffa0 R15: 00007fff311df078
 </TASK>
---[ end trace c5f183b66fdb6f55 ]---

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/07/25 06:23 android13-5.15-lts 61d896ee2a80 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in l2tp_tunnel_get_session
2026/07/24 05:11 android13-5.15-lts 61d896ee2a80 544adce9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in l2tp_tunnel_get_session
2026/06/29 03:28 android13-5.15-lts c85054db4618 fb92f11c .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in l2tp_tunnel_get_session
2026/06/26 07:56 android13-5.15-lts c85054db4618 7ff32d8b .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in l2tp_tunnel_get_session
* Struck through repros no longer work on HEAD.