================================================================== BUG: KASAN: use-after-free in ext4_htree_fill_tree+0x131b/0x13e0 fs/ext4/namei.c:1246 Read of size 1 at addr ffff88811e847a67 by task syz-executor366/295 CPU: 0 PID: 295 Comm: syz-executor366 Not tainted 5.15.173-syzkaller-00161-gb4bd207b0380 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306 ext4_htree_fill_tree+0x131b/0x13e0 fs/ext4/namei.c:1246 ext4_dx_readdir fs/ext4/dir.c:606 [inline] ext4_readdir+0x2f75/0x3960 fs/ext4/dir.c:142 iterate_dir+0x265/0x600 __do_sys_getdents64 fs/readdir.c:369 [inline] __se_sys_getdents64+0x1c1/0x460 fs/readdir.c:354 __x64_sys_getdents64+0x7b/0x90 fs/readdir.c:354 x64_sys_call+0x5ae/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:218 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7f1cea7e3033 Code: c1 66 0f 1f 44 00 00 48 83 c4 08 48 89 ef 5b 5d e9 e2 c1 fa ff 66 90 b8 ff ff ff 7f 48 39 c2 48 0f 47 d0 b8 d9 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 05 c3 0f 1f 40 00 48 c7 c2 b0 ff ff ff f7 d8 RSP: 002b:00007ffd8043a8f8 EFLAGS: 00000293 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 0000555594899830 RCX: 00007f1cea7e3033 RDX: 0000000000008000 RSI: 0000555594899830 RDI: 0000000000000004 RBP: 0000555594899804 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000001000 R11: 0000000000000293 R12: ffffffffffffffb0 R13: 0000000000000010 R14: 0000555594899800 R15: 00007ffd8043cb44 Allocated by task 236: 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+0xdb/0x110 mm/kasan/common.c:512 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521 kasan_kmalloc include/linux/kasan.h:227 [inline] __kmalloc_track_caller+0x13e/0x2c0 mm/slub.c:4954 kmalloc_reserve net/core/skbuff.c:357 [inline] __alloc_skb+0x10c/0x550 net/core/skbuff.c:428 __napi_alloc_skb+0x167/0x2e0 net/core/skbuff.c:569 napi_alloc_skb include/linux/skbuff.h:3079 [inline] page_to_skb+0x2a5/0xb40 drivers/net/virtio_net.c:454 receive_mergeable drivers/net/virtio_net.c:1070 [inline] receive_buf+0xed9/0x5860 drivers/net/virtio_net.c:1180 virtnet_receive drivers/net/virtio_net.c:1472 [inline] virtnet_poll+0x615/0x1250 drivers/net/virtio_net.c:1585 __napi_poll+0xc4/0x5a0 net/core/dev.c:7051 napi_poll net/core/dev.c:7118 [inline] net_rx_action+0x47d/0xc50 net/core/dev.c:7208 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565 __do_softirq kernel/softirq.c:603 [inline] invoke_softirq kernel/softirq.c:425 [inline] __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:652 irq_exit_rcu+0x9/0x10 kernel/softirq.c:664 common_interrupt+0x68/0xe0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x27/0x40 arch/x86/include/asm/idtentry.h:667 Freed by task 234: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x126/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:1723 [inline] slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749 slab_free mm/slub.c:3521 [inline] kfree+0xcc/0x270 mm/slub.c:4583 skb_free_head net/core/skbuff.c:656 [inline] skb_release_data+0x8a9/0xa80 net/core/skbuff.c:678 skb_release_all net/core/skbuff.c:743 [inline] __kfree_skb+0x50/0x70 net/core/skbuff.c:757 sk_eat_skb include/net/sock.h:2734 [inline] tcp_recvmsg_locked+0x17fd/0x2890 net/ipv4/tcp.c:2517 tcp_recvmsg+0x24e/0x7f0 net/ipv4/tcp.c:2563 inet_recvmsg+0x158/0x500 net/ipv4/af_inet.c:863 sock_recvmsg_nosec net/socket.c:966 [inline] sock_recvmsg net/socket.c:984 [inline] sock_read_iter+0x353/0x480 net/socket.c:1057 call_read_iter include/linux/fs.h:2200 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0xa81/0xd40 fs/read_write.c:485 ksys_read+0x199/0x2c0 fs/read_write.c:623 __do_sys_read fs/read_write.c:633 [inline] __se_sys_read fs/read_write.c:631 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:631 x64_sys_call+0x28/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88811e847800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 615 bytes inside of 1024-byte region [ffff88811e847800, ffff88811e847c00) The buggy address belongs to the page: page:ffffea00047a1000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11e840 head:ffffea00047a1000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 0000000000000000 dead000000000122 ffff888100043080 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 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 0, ts 15796021232, free_ts 13657665590 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779 allocate_slab mm/slub.c:1932 [inline] new_slab+0x9a/0x4e0 mm/slub.c:1995 ___slab_alloc+0x39e/0x830 mm/slub.c:3028 __slab_alloc+0x4a/0x90 mm/slub.c:3115 slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3250 [inline] __kmalloc_track_caller+0x171/0x2c0 mm/slub.c:4949 kmalloc_reserve net/core/skbuff.c:357 [inline] __alloc_skb+0x10c/0x550 net/core/skbuff.c:428 __napi_alloc_skb+0x167/0x2e0 net/core/skbuff.c:569 napi_alloc_skb include/linux/skbuff.h:3079 [inline] page_to_skb+0x2a5/0xb40 drivers/net/virtio_net.c:454 receive_mergeable drivers/net/virtio_net.c:1070 [inline] receive_buf+0xed9/0x5860 drivers/net/virtio_net.c:1180 virtnet_receive drivers/net/virtio_net.c:1472 [inline] virtnet_poll+0x615/0x1250 drivers/net/virtio_net.c:1585 __napi_poll+0xc4/0x5a0 net/core/dev.c:7051 napi_poll net/core/dev.c:7118 [inline] net_rx_action+0x47d/0xc50 net/core/dev.c:7208 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534 free_unref_page+0xe8/0x750 mm/page_alloc.c:3616 __put_single_page mm/swap.c:98 [inline] __put_page+0xb0/0xe0 mm/swap.c:129 put_page include/linux/mm.h:1295 [inline] anon_pipe_buf_release+0x187/0x200 fs/pipe.c:137 pipe_buf_release include/linux/pipe_fs_i.h:219 [inline] pipe_read+0x5a6/0x1040 fs/pipe.c:323 call_read_iter include/linux/fs.h:2200 [inline] new_sync_read fs/read_write.c:404 [inline] vfs_read+0xa81/0xd40 fs/read_write.c:485 ksys_read+0x199/0x2c0 fs/read_write.c:623 __do_sys_read fs/read_write.c:633 [inline] __se_sys_read fs/read_write.c:631 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:631 x64_sys_call+0x28/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Memory state around the buggy address: ffff88811e847900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811e847980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88811e847a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88811e847a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88811e847b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================