BUG: KASAN: slab-use-after-free in kernfs_test_super+0x122/0x150 fs/kernfs/mount.c:286 Read of size 8 at addr ffff888023bafa88 by task syz-executor.0/11592 CPU: 1 PID: 11592 Comm: syz-executor.0 Not tainted 6.5.0-syzkaller-01207-g1c59d383390f #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 kernfs_test_super+0x122/0x150 fs/kernfs/mount.c:286 sget_fc+0x582/0x9b0 fs/super.c:778 kernfs_get_tree+0x198/0x990 fs/kernfs/mount.c:337 sysfs_get_tree+0x41/0x140 fs/sysfs/mount.c:31 vfs_get_tree+0x8c/0x370 fs/super.c:1711 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fe1dd67cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fe1de3810c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fe1dd79bf80 RCX: 00007fe1dd67cae9 RDX: 00000000200000c0 RSI: 0000000020027000 RDI: 0000000000000000 RBP: 00007fe1dd6c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fe1dd79bf80 R15: 00007ffda86060d8 Allocated by task 11590: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:582 [inline] kzalloc include/linux/slab.h:703 [inline] kernfs_get_tree+0x78/0x990 fs/kernfs/mount.c:328 sysfs_get_tree+0x41/0x140 fs/sysfs/mount.c:31 vfs_get_tree+0x8c/0x370 fs/super.c:1711 do_new_mount fs/namespace.c:3335 [inline] path_mount+0x1492/0x1ed0 fs/namespace.c:3662 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount fs/namespace.c:3861 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5159: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x13f/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564 sysfs_kill_sb+0x21/0x30 fs/sysfs/mount.c:86 deactivate_locked_super+0xa0/0x2d0 fs/super.c:454 deactivate_super+0xde/0x100 fs/super.c:504 cleanup_mnt+0x222/0x3d0 fs/namespace.c:1254 task_work_run+0x14d/0x240 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x60 kernel/entry/common.c:296 do_syscall_64+0x44/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888023bafa80 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 8 bytes inside of freed 64-byte region [ffff888023bafa80, ffff888023bafac0) The buggy address belongs to the physical page: page:ffffea00008eebc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x23baf flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x20() raw: 00fff00000000200 ffff888012840200 ffffea0000aef450 ffffea0000979cd0 raw: 0000000000000000 ffff888023baf000 0000000100000020 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x3420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 5159, tgid 5159 (syz-executor.2), ts 259726055644, free_ts 259723852946 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1356 [inline] cache_grow_begin+0x99/0x3a0 mm/slab.c:2550 cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923 ____cache_alloc mm/slab.c:2999 [inline] ____cache_alloc mm/slab.c:2982 [inline] __do_cache_alloc mm/slab.c:3182 [inline] slab_alloc_node mm/slab.c:3230 [inline] __kmem_cache_alloc_node+0x3c9/0x470 mm/slab.c:3521 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc+0x4c/0x100 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:703 [inline] ext4_htree_store_dirent+0x92/0x690 fs/ext4/dir.c:474 htree_dirblock_to_tree+0x585/0xd10 fs/ext4/namei.c:1138 ext4_htree_fill_tree+0x395/0xc80 fs/ext4/namei.c:1217 ext4_dx_readdir fs/ext4/dir.c:597 [inline] ext4_readdir+0x2016/0x3720 fs/ext4/dir.c:142 iterate_dir+0x1e5/0x5f0 fs/readdir.c:106 __do_sys_getdents64 fs/readdir.c:405 [inline] __se_sys_getdents64 fs/readdir.c:390 [inline] __x64_sys_getdents64+0x14f/0x2e0 fs/readdir.c:390 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443 skb_free_frag include/linux/skbuff.h:3247 [inline] skb_free_head+0xa6/0x1b0 net/core/skbuff.c:904 skb_release_data+0x5ba/0x870 net/core/skbuff.c:936 skb_release_all net/core/skbuff.c:1002 [inline] __kfree_skb+0x51/0x70 net/core/skbuff.c:1016 tcp_rcv_established+0x1130/0x1fa0 net/ipv4/tcp_input.c:5935 tcp_v4_do_rcv+0x669/0x9e0 net/ipv4/tcp_ipv4.c:1728 tcp_v4_rcv+0x3202/0x3620 net/ipv4/tcp_ipv4.c:2150 ip_protocol_deliver_rcu+0x9f/0x480 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x2e6/0x520 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:303 [inline] NF_HOOK include/linux/netfilter.h:297 [inline] ip_local_deliver+0x1be/0x540 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:468 [inline] ip_sublist_rcv_finish+0x99/0x2d0 net/ipv4/ip_input.c:580 ip_list_rcv_finish.constprop.0+0x50a/0x6d0 net/ipv4/ip_input.c:630 ip_sublist_rcv net/ipv4/ip_input.c:638 [inline] ip_list_rcv+0x331/0x440 net/ipv4/ip_input.c:673 __netif_receive_skb_list_ptype net/core/dev.c:5495 [inline] __netif_receive_skb_list_core+0x52c/0x8a0 net/core/dev.c:5543 __netif_receive_skb_list net/core/dev.c:5595 [inline] netif_receive_skb_list_internal+0x76b/0xe00 net/core/dev.c:5686 Memory state around the buggy address: ffff888023baf980: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888023bafa00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff888023bafa80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888023bafb00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888023bafb80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================