================================================================== BUG: KASAN: use-after-free in ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2119 Write of size 251 at addr ffff888045696f14 by task syz.0.0/5320 CPU: 0 UID: 0 PID: 5320 Comm: syz.0.0 Not tainted 6.12.0-syzkaller-12113-gbcc8eda6d349 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x40/0x70 mm/kasan/shadow.c:106 ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2119 add_dirent_to_buf+0x3d9/0x750 fs/ext4/namei.c:2164 make_indexed_dir+0xf98/0x1600 fs/ext4/namei.c:2361 ext4_add_entry+0xcf7/0xfa0 fs/ext4/namei.c:2462 ext4_add_nondir+0x8d/0x290 fs/ext4/namei.c:2803 ext4_symlink+0x920/0xb50 fs/ext4/namei.c:3438 vfs_symlink+0x137/0x2e0 fs/namei.c:4669 do_symlinkat+0x222/0x3a0 fs/namei.c:4695 __do_sys_symlink fs/namei.c:4716 [inline] __se_sys_symlink fs/namei.c:4714 [inline] __x64_sys_symlink+0x7a/0x90 fs/namei.c:4714 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fac24d80849 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:00007fac25bd7058 EFLAGS: 00000246 ORIG_RAX: 0000000000000058 RAX: ffffffffffffffda RBX: 00007fac24f46080 RCX: 00007fac24d80849 RDX: 0000000000000000 RSI: 0000000020000cc0 RDI: 0000000020000dc0 RBP: 00007fac24df3986 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fac24f46080 R15: 00007ffd52272b58 The buggy address belongs to the physical page: page: refcount:3 mapcount:0 mapping:ffff888031cd4d78 index:0x3f pfn:0x45696 memcg:ffff88801c6ce000 aops:def_blk_aops ino:700000 dentry name(?):"" flags: 0x4fff08000004214(referenced|dirty|workingset|private|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff08000004214 0000000000000000 dead000000000122 ffff888031cd4d78 raw: 000000000000003f ffff888043e78910 00000003ffffffff ffff88801c6ce000 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 5320, tgid 5318 (syz.0.0), ts 96766260551, free_ts 95051406764 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3474 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265 alloc_pages_noprof mm/mempolicy.c:2344 [inline] folio_alloc_noprof+0x128/0x180 mm/mempolicy.c:2351 filemap_alloc_folio_noprof+0xdf/0x500 mm/filemap.c:1009 __filemap_get_folio+0x446/0xbd0 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+0x1d8/0x550 fs/buffer.c:1431 getblk_unmovable include/linux/buffer_head.h:369 [inline] ext4_getblk+0x31b/0x880 fs/ext4/inode.c:864 ext4_bread+0x2e/0x180 fs/ext4/inode.c:912 ext4_append+0x327/0x5c0 fs/ext4/namei.c:83 make_indexed_dir+0x523/0x1600 fs/ext4/namei.c:2282 ext4_add_entry+0xcf7/0xfa0 fs/ext4/namei.c:2462 ext4_add_nondir+0x8d/0x290 fs/ext4/namei.c:2803 ext4_symlink+0x920/0xb50 fs/ext4/namei.c:3438 vfs_symlink+0x137/0x2e0 fs/namei.c:4669 page last free pid 9 tgid 9 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0xdef/0x1130 mm/page_alloc.c:2657 discard_slab mm/slub.c:2673 [inline] __put_partials+0xeb/0x130 mm/slub.c:3142 put_cpu_partial+0x17c/0x250 mm/slub.c:3217 __slab_free+0x2ea/0x3d0 mm/slub.c:4468 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9a/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/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+0x1d9/0x380 mm/slub.c:4205 __alloc_skb+0x1c3/0x440 net/core/skbuff.c:668 alloc_skb include/linux/skbuff.h:1323 [inline] alloc_skb_with_frags+0xc3/0x820 net/core/skbuff.c:6612 sock_alloc_send_pskb+0x91a/0xa60 net/core/sock.c:2881 sock_alloc_send_skb include/net/sock.h:1797 [inline] mld_newpack+0x1c3/0xaf0 net/ipv6/mcast.c:1747 add_grhead net/ipv6/mcast.c:1850 [inline] add_grec+0x1492/0x19a0 net/ipv6/mcast.c:1988 mld_send_cr net/ipv6/mcast.c:2114 [inline] mld_ifc_work+0x691/0xd90 net/ipv6/mcast.c:2651 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 Memory state around the buggy address: ffff888045696f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888045696f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888045697000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888045697080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888045697100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================