KASAN: use-after-free Read in dev_open

Status: upstream: reported C repro on 2026/08/29 13:07
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+6fa7ec5dea79a7b98206@syzkaller.appspotmail.com
First crash: 9d07h, last: 4d23h
Bug presence (2)
Date Name Commit Repro Result
2026/08/29 linux-5.15.y (ToT) 28c35638ec51 C [report] KASAN: use-after-free Read in dev_open
2026/08/29 upstream (ToT) cf72cbb39da8 C Didn't crash

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x107/0x7b50 kernel/locking/lockdep.c:4882
Read of size 8 at addr ffff888073ff6018 by task syz.0.18/4352

CPU: 1 PID: 4352 Comm: syz.0.18 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 __lock_acquire+0x107/0x7b50 kernel/locking/lockdep.c:4882
 lock_acquire+0x19e/0x400 kernel/locking/lockdep.c:5623
 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline]
 _raw_spin_lock_irq+0xab/0xf0 kernel/locking/spinlock.c:170
 spin_lock_irq include/linux/spinlock.h:389 [inline]
 dev_open+0x47/0x1b0 drivers/usb/gadget/legacy/inode.c:1917
 do_dentry_open+0x7f7/0xf90 fs/open.c:826
 do_open fs/namei.c:3659 [inline]
 path_openat+0x2718/0x2fb0 fs/namei.c:3793
 do_filp_open+0x1df/0x400 fs/namei.c:3820
 do_sys_openat2+0x14b/0x500 fs/open.c:1255
 do_sys_open fs/open.c:1271 [inline]
 __do_sys_openat fs/open.c:1287 [inline]
 __se_sys_openat fs/open.c:1282 [inline]
 __x64_sys_openat+0x135/0x160 fs/open.c:1282
 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:0x7ff675823159
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:00007ffffb41bd98 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007ff675aaafa0 RCX: 00007ff675823159
RDX: 0000000000000802 RSI: 0000200000000300 RDI: ffffffffffffff9c
RBP: 00007ff6758ba024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ff675aaafac R14: 00007ff675aaafa0 R15: 00007ff675aaafa0
 </TASK>

Allocated by task 4293:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xaf/0xe0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:607 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 dev_new drivers/usb/gadget/legacy/inode.c:170 [inline]
 gadgetfs_fill_super+0x30d/0x610 drivers/usb/gadget/legacy/inode.c:2052
 vfs_get_super fs/super.c:1183 [inline]
 get_tree_single+0xb5/0x160 fs/super.c:1221
 vfs_get_tree+0x88/0x270 fs/super.c:1541
 do_new_mount+0x247/0xa40 fs/namespace.c:3034
 do_mount fs/namespace.c:3377 [inline]
 __do_sys_mount fs/namespace.c:3585 [inline]
 __se_sys_mount+0x2e3/0x3d0 fs/namespace.c:3562
 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 4351:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1710 [inline]
 slab_free_freelist_hook+0xec/0x170 mm/slub.c:1736
 slab_free mm/slub.c:3504 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4564
 put_dev drivers/usb/gadget/legacy/inode.c:163 [inline]
 dev_release+0x163/0x1f0 drivers/usb/gadget/legacy/inode.c:1214
 __fput+0x212/0x8c0 fs/file_table.c:311
 task_work_run+0x125/0x1a0 kernel/task_work.c:188
 exit_task_work include/linux/task_work.h:33 [inline]
 do_exit+0x635/0x2110 kernel/exit.c:890
 do_group_exit+0x12c/0x2f0 kernel/exit.c:1004
 get_signal+0x7eb/0x12e0 kernel/signal.c:2909
 arch_do_signal_or_restart+0xe6/0x12a0 arch/x86/kernel/signal.c:867
 handle_signal_work kernel/entry/common.c:154 [inline]
 exit_to_user_mode_loop+0x9e/0x130 kernel/entry/common.c:178
 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888073ff6000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 24 bytes inside of
 1024-byte region [ffff888073ff6000, ffff888073ff6400)
The buggy address belongs to the page:
page:ffffea0001cffc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73ff0
head:ffffea0001cffc00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016c41dc0
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4036, ts 43270547316, free_ts 43269915052
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x24f6/0x2670 mm/page_alloc.c:4192
 __alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
 alloc_slab_page mm/slub.c:1780 [inline]
 allocate_slab mm/slub.c:1917 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1980
 ___slab_alloc+0x807/0xdd0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 __kmalloc_node_track_caller+0x13d/0x3a0 mm/slub.c:4963
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x22c/0x750 net/core/skbuff.c:427
 alloc_skb_fclone include/linux/skbuff.h:1212 [inline]
 sk_stream_alloc_skb+0x204/0xb50 net/ipv4/tcp.c:892
 tcp_sendmsg_locked+0xcbb/0x3330 net/ipv4/tcp.c:1317
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1460
 sock_sendmsg_nosec net/socket.c:706 [inline]
 __sock_sendmsg net/socket.c:718 [inline]
 sock_write_iter+0x2a6/0x3a0 net/socket.c:1090
 call_write_iter include/linux/fs.h:2179 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 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 last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x8f/0x2a0 mm/page_alloc.c:3396
 put_page include/linux/mm.h:1258 [inline]
 __skb_frag_unref include/linux/skbuff.h:3254 [inline]
 skb_release_data+0x35c/0x830 net/core/skbuff.c:672
 skb_release_all net/core/skbuff.c:742 [inline]
 __kfree_skb+0x4c/0x60 net/core/skbuff.c:756
 sk_eat_skb include/net/sock.h:2793 [inline]
 tcp_recvmsg_locked+0x143d/0x2690 net/ipv4/tcp.c:2520
 tcp_recvmsg+0x22a/0x760 net/ipv4/tcp.c:2566
 inet_recvmsg+0x146/0x200 net/ipv4/af_inet.c:868
 sock_recvmsg_nosec net/socket.c:969 [inline]
 sock_recvmsg net/socket.c:987 [inline]
 sock_read_iter+0x2c2/0x380 net/socket.c:1068
 call_read_iter include/linux/fs.h:2173 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0x75e/0xd50 fs/read_write.c:485
 ksys_read+0x153/0x260 fs/read_write.c:623
 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

Memory state around the buggy address:
 ffff888073ff5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888073ff5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888073ff6000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff888073ff6080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888073ff6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (9):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/31 04:04 linux-5.15.y 28c35638ec51 2f52988a .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/08/29 14:22 linux-5.15.y 28c35638ec51 2f52988a .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/08/29 13:06 linux-5.15.y 28c35638ec51 2f52988a .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/09/02 20:32 linux-5.15.y 0996e0926f6b 85995287 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/09/01 06:27 linux-5.15.y 28c35638ec51 316d9396 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/09/01 06:27 linux-5.15.y 28c35638ec51 316d9396 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/08/31 21:48 linux-5.15.y 28c35638ec51 316d9396 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/08/31 10:30 linux-5.15.y 28c35638ec51 2f52988a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
2026/08/31 10:29 linux-5.15.y 28c35638ec51 2f52988a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in dev_open
* Struck through repros no longer work on HEAD.