KASAN: use-after-free Read in f2fs_drop_inode

Status: upstream: reported on 2026/09/07 20:21
Reported-by: syzbot+a26cce9cef6f5129d873@syzkaller.appspotmail.com
First crash: 13d, last: 13d

Sample crash report:
loop0: rw=8192, want=36920, limit=64
F2FS-fs (loop0): Cannot recover all fsync data errno=-5
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
BUG: KASAN: use-after-free in is_sbi_flag_set fs/f2fs/f2fs.h:2012 [inline]
BUG: KASAN: use-after-free in f2fs_drop_inode+0x6e/0x920 fs/f2fs/super.c:1432
Read of size 8 at addr ffff88805a9380b8 by task syz.0.121/4810

CPU: 1 PID: 4810 Comm: syz.0.121 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
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x235/0x290 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:71 [inline]
 test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
 is_sbi_flag_set fs/f2fs/f2fs.h:2012 [inline]
 f2fs_drop_inode+0x6e/0x920 fs/f2fs/super.c:1432
 iput_final fs/inode.c:1739 [inline]
 iput+0x424/0x880 fs/inode.c:1795
 __dentry_kill+0x412/0x630 fs/dcache.c:586
 shrink_dentry_list+0x388/0x680 fs/dcache.c:1181
 shrink_dcache_sb+0x24e/0x3d0 fs/dcache.c:1301
 f2fs_fill_super+0x3d1f/0x7050 fs/f2fs/super.c:4543
 mount_bdev+0x28a/0x3c0 fs/super.c:1411
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 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
RIP: 0033:0x7f588ec373ca
Code: 48 c7 c2 e8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 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:00007f588ce8de58 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f588ce8dee0 RCX: 00007f588ec373ca
RDX: 0000200000000100 RSI: 0000200000000140 RDI: 00007f588ce8dea0
RBP: 0000200000000100 R08: 00007f588ce8dee0 R09: 0000000000800080
R10: 0000000000800080 R11: 0000000000000246 R12: 0000200000000140
R13: 00007f588ce8dea0 R14: 00000000000105ea R15: 0000200000000540
 </TASK>

Allocated by task 4810:
 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]
 f2fs_fill_super+0xc8/0x7050 fs/f2fs/super.c:4041
 mount_bdev+0x28a/0x3c0 fs/super.c:1411
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 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 4810:
 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
 f2fs_fill_super+0x3cec/0x7050 fs/f2fs/super.c:4538
 mount_bdev+0x28a/0x3c0 fs/super.c:1411
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 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

The buggy address belongs to the object at ffff88805a938000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 184 bytes inside of
 8192-byte region [ffff88805a938000, ffff88805a93a000)
The buggy address belongs to the page:
page:ffffea00016a4e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5a938
head:ffffea00016a4e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001e5cc00 0000000200000002 ffff888016c42280
raw: 0000000000000000 0000000000020002 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4318, ts 84880919134, free_ts 84511455795
 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 include/linux/skbuff.h:1162 [inline]
 alloc_skb_with_frags+0xa7/0x720 net/core/skbuff.c:6196
 sock_alloc_send_pskb+0x87f/0x9a0 net/core/sock.c:2535
 rawv6_send_hdrinc+0x2f4/0x1650 net/ipv6/raw.c:612
 rawv6_sendmsg+0x11a6/0x1710 net/ipv6/raw.c:917
 sock_sendmsg_nosec net/socket.c:706 [inline]
 __sock_sendmsg net/socket.c:718 [inline]
 sock_sendmsg net/socket.c:741 [inline]
 kernel_sendmsg+0x23e/0x350 net/socket.c:765
 sock_no_sendpage+0x12a/0x1a0 net/core/sock.c:3044
 kernel_sendpage+0x2cc/0x380 net/socket.c:3549
 sock_sendpage+0x7a/0xb0 net/socket.c:1028
 pipe_to_sendpage+0x22f/0x320 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x333/0x8e0 fs/splice.c:562
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_pages_ok+0x8b1/0x950 mm/page_alloc.c:1643
 free_nonslab_page+0xde/0x150 mm/slub.c:3540
 kmem_free fs/xfs/kmem.h:62 [inline]
 xlog_write_log_records+0x34e/0x3c0 fs/xfs/xfs_log_recover.c:1587
 xlog_clear_stale_blocks+0x242/0x420 fs/xfs/xfs_log_recover.c:1682
 xlog_find_tail+0x7c0/0xa50 fs/xfs/xfs_log_recover.c:1366
 xlog_recover+0x48/0x3e0 fs/xfs/xfs_log_recover.c:3397
 xfs_log_mount+0x375/0x690 fs/xfs/xfs_log.c:710
 xfs_mountfs+0xafc/0x1ae0 fs/xfs/xfs_mount.c:765
 xfs_fs_fill_super+0x119b/0x13e0 fs/xfs/xfs_super.c:1684
 get_tree_bdev+0x3e6/0x610 fs/super.c:1336
 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

Memory state around the buggy address:
 ffff88805a937f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805a938000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805a938080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff88805a938100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805a938180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/09/07 20:20 linux-5.15.y 0996e0926f6b 680aa3e1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in f2fs_drop_inode
* Struck through repros no longer work on HEAD.