================================================================== BUG: KASAN: use-after-free in ext4_insert_dentry+0x3b2/0x770 fs/ext4/namei.c:2119 Write of size 250 at addr ffff888119c8ff18 by task syz.2.15/476 CPU: 1 UID: 0 PID: 476 Comm: syz.2.15 Not tainted 6.12.0-syzkaller-11677-g2ba9f676d0a2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x184/0x200 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x163/0x550 mm/kasan/report.c:489 kasan_report+0x15f/0x190 mm/kasan/report.c:602 kasan_check_range+0x238/0x2b0 mm/kasan/generic.c:189 __asan_memcpy+0x44/0x70 mm/kasan/shadow.c:106 ext4_insert_dentry+0x3b2/0x770 fs/ext4/namei.c:2119 add_dirent_to_buf+0x3d5/0x740 fs/ext4/namei.c:2164 make_indexed_dir+0xf3e/0x15a0 fs/ext4/namei.c:2361 ext4_add_entry+0xc35/0xea0 fs/ext4/namei.c:2462 ext4_mkdir+0x550/0xce0 fs/ext4/namei.c:3039 vfs_mkdir+0x2fc/0x4f0 fs/namei.c:4311 do_mkdirat+0x218/0x310 fs/namei.c:4334 __do_sys_mkdirat fs/namei.c:4349 [inline] __se_sys_mkdirat fs/namei.c:4347 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4347 x64_sys_call+0x1b9a/0x2df0 arch/x86/include/generated/asm/syscalls_64.h:259 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x50/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7f9b6d380849 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9b6e1b9058 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007f9b6d545fa0 RCX: 00007f9b6d380849 RDX: 0000000000000000 RSI: 00000000200005c0 RDI: ffffffffffffff9c RBP: 00007f9b6d3f3986 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f9b6d545fa0 R15: 00007ffc4f593b68 The buggy address belongs to the physical page: page: refcount:3 mapcount:0 mapping:ffff88811057dce0 index:0x3f pfn:0x119c8f memcg:ffff88810226b000 aops:def_blk_aops ino:700002 dentry name(?):"" flags: 0x4200000000004214(referenced|dirty|workingset|private|zone=1) raw: 4200000000004214 0000000000000000 dead000000000122 ffff88811057dce0 raw: 000000000000003f ffff888112c495e8 00000003ffffffff ffff88810226b000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x148c40(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL), pid 476, tgid 475 (syz.2.15), ts 54828189211, free_ts 54753895517 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x224/0x250 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0x47ee/0x4880 mm/page_alloc.c:3474 __alloc_pages_noprof+0x3c3/0x7d0 mm/page_alloc.c:4751 __folio_alloc_noprof+0x10/0x70 mm/page_alloc.c:4783 __folio_alloc_node_noprof include/linux/gfp.h:280 [inline] folio_alloc_noprof include/linux/gfp.h:322 [inline] filemap_alloc_folio_noprof include/linux/pagemap.h:668 [inline] __filemap_get_folio+0x344/0x5b0 mm/filemap.c:1951 grow_dev_folio fs/buffer.c:1039 [inline] grow_buffers fs/buffer.c:1105 [inline] __getblk_slow fs/buffer.c:1131 [inline] bdev_getblk+0x188/0x4c0 fs/buffer.c:1431 getblk_unmovable include/linux/buffer_head.h:369 [inline] ext4_getblk+0x315/0x860 fs/ext4/inode.c:864 ext4_bread+0x2f/0x180 fs/ext4/inode.c:912 ext4_append+0x323/0x5c0 fs/ext4/namei.c:83 make_indexed_dir+0x508/0x15a0 fs/ext4/namei.c:2282 ext4_add_entry+0xc35/0xea0 fs/ext4/namei.c:2462 ext4_mkdir+0x550/0xce0 fs/ext4/namei.c:3039 vfs_mkdir+0x2fc/0x4f0 fs/namei.c:4311 do_mkdirat+0x218/0x310 fs/namei.c:4334 __do_sys_mkdirat fs/namei.c:4349 [inline] __se_sys_mkdirat fs/namei.c:4347 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4347 x64_sys_call+0x1b9a/0x2df0 arch/x86/include/generated/asm/syscalls_64.h:259 page last free pid 425 tgid 425 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0xa26/0xab0 mm/page_alloc.c:2657 __free_pages+0x5b/0xe0 mm/page_alloc.c:4838 __free_slab+0xcb/0x110 mm/slub.c:2644 free_slab+0x24/0xd0 mm/slub.c:2667 discard_slab mm/slub.c:2673 [inline] __put_partials+0x115/0x130 mm/slub.c:3142 put_cpu_partial+0xa9/0x100 mm/slub.c:3217 __slab_free+0x24b/0x300 mm/slub.c:4468 do_slab_free mm/slub.c:4550 [inline] ___cache_free+0xd1/0xe0 mm/slub.c:4656 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0xb7/0x130 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x150/0x180 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4104 [inline] slab_alloc_node mm/slub.c:4153 [inline] kmem_cache_alloc_node_noprof+0x113/0x2c0 mm/slub.c:4205 __alloc_skb+0x1a1/0x420 net/core/skbuff.c:668 alloc_skb include/linux/skbuff.h:1323 [inline] netlink_alloc_large_skb+0xcc/0x100 net/netlink/af_netlink.c:1196 netlink_sendmsg+0x60e/0xc70 net/netlink/af_netlink.c:1866 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x23b/0x290 net/socket.c:726 Memory state around the buggy address: ffff888119c8ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888119c8ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888119c90000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888119c90080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888119c90100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================