================================================================== BUG: KASAN: double-free or invalid-free in kfree+0x19e/0x220 mm/slub.c:4574 CPU: 1 PID: 12831 Comm: syz-executor.2 Not tainted 5.15.106-syzkaller-00249-g19c0ed55a470 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 kasan_report_invalid_free+0x6b/0xa0 mm/kasan/report.c:370 __kasan_kfree_large+0x82/0x90 mm/kasan/common.c:398 kasan_kfree_large include/linux/kasan.h:201 [inline] kfree_hook mm/slub.c:1687 [inline] free_nonslab_page+0x3c/0xc0 mm/slub.c:3551 kfree+0x19e/0x220 mm/slub.c:4574 kvfree+0x35/0x40 mm/util.c:658 ext4_xattr_move_to_block fs/ext4/xattr.c:2628 [inline] ext4_xattr_make_inode_space fs/ext4/xattr.c:2691 [inline] ext4_expand_extra_isize_ea+0x1063/0x1bc0 fs/ext4/xattr.c:2783 __ext4_expand_extra_isize+0x303/0x3f0 fs/ext4/inode.c:5859 ext4_try_to_expand_extra_isize fs/ext4/inode.c:5902 [inline] __ext4_mark_inode_dirty+0x4af/0x7a0 fs/ext4/inode.c:5980 ext4_set_acl+0x493/0x730 fs/ext4/acl.c:263 set_posix_acl fs/posix_acl.c:947 [inline] posix_acl_xattr_set+0x361/0x3d0 fs/posix_acl.c:966 __vfs_setxattr+0x3ed/0x440 fs/xattr.c:182 __vfs_setxattr_noperm+0x126/0x5e0 fs/xattr.c:216 __vfs_setxattr_locked+0x215/0x230 fs/xattr.c:277 vfs_setxattr+0x21d/0x420 fs/xattr.c:303 do_setxattr fs/xattr.c:588 [inline] setxattr+0x27e/0x2e0 fs/xattr.c:611 path_setxattr+0x1bc/0x2a0 fs/xattr.c:630 __do_sys_lsetxattr fs/xattr.c:653 [inline] __se_sys_lsetxattr fs/xattr.c:649 [inline] __x64_sys_lsetxattr+0xc2/0xe0 fs/xattr.c:649 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f2f0aa80169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2f097f3168 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd RAX: ffffffffffffffda RBX: 00007f2f0ab9ff80 RCX: 00007f2f0aa80169 RDX: 0000000020000240 RSI: 00000000200000c0 RDI: 0000000020000080 RBP: 00007f2f0aadbca1 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000003c R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd729fa74f R14: 00007f2f097f3300 R15: 0000000000022000 The buggy address belongs to the page: page:ffffea0005b7fd40 refcount:2 mapcount:0 mapping:ffff888109127258 index:0x1 pfn:0x16dff5 memcg:ffff888113044000 aops:def_blk_aops ino:700002 flags: 0x400000000002203e(referenced|uptodate|dirty|lru|active|private|mappedtodisk|zone=1) raw: 400000000002203e ffffea0004589948 ffffea000591ee88 ffff888109127258 raw: 0000000000000001 ffff88817b837bd0 00000002ffffffff ffff888113044000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x108c48(GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE), pid 12831, ts 380521503920, free_ts 380520710866 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2502 prep_new_page mm/page_alloc.c:2508 [inline] get_page_from_freelist+0x2c14/0x2cf0 mm/page_alloc.c:4291 __alloc_pages+0x386/0x7b0 mm/page_alloc.c:5569 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] __page_cache_alloc include/linux/pagemap.h:305 [inline] pagecache_get_page+0xb18/0xeb0 mm/filemap.c:1940 find_or_create_page include/linux/pagemap.h:418 [inline] grow_dev_page fs/buffer.c:949 [inline] grow_buffers fs/buffer.c:1014 [inline] __getblk_slow fs/buffer.c:1041 [inline] __getblk_gfp+0x21e/0x7c0 fs/buffer.c:1336 sb_getblk include/linux/buffer_head.h:361 [inline] __ext4_get_inode_loc+0x4ce/0xcd0 fs/ext4/inode.c:4352 __ext4_get_inode_loc_noinmem fs/ext4/inode.c:4460 [inline] __ext4_iget+0x467/0x3e40 fs/ext4/inode.c:4665 ext4_fill_super+0x7570/0x9680 fs/ext4/super.c:4829 mount_bdev+0x281/0x3b0 fs/super.c:1378 ext4_mount+0x34/0x40 fs/ext4/super.c:6567 legacy_get_tree+0xf1/0x190 fs/fs_context.c:610 vfs_get_tree+0x88/0x290 fs/super.c:1508 do_new_mount+0x28b/0xac0 fs/namespace.c:2994 path_mount+0x671/0x1070 fs/namespace.c:3324 do_mount fs/namespace.c:3337 [inline] __do_sys_mount fs/namespace.c:3545 [inline] __se_sys_mount+0x2c4/0x3b0 fs/namespace.c:3522 __x64_sys_mount+0xbf/0xd0 fs/namespace.c:3522 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1370 [inline] free_pcp_prepare mm/page_alloc.c:1442 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3441 free_unref_page_list+0x15d/0x980 mm/page_alloc.c:3562 release_pages+0x1310/0x1370 mm/swap.c:1009 __pagevec_lru_add+0xcde/0xd70 mm/swap.c:1102 lru_add_drain_cpu+0xf0/0x5d0 mm/swap.c:642 lru_add_drain+0x3d/0xc0 mm/swap.c:747 __pagevec_release+0x56/0x100 mm/swap.c:1026 pagevec_release include/linux/pagevec.h:81 [inline] shmem_undo_range+0x604/0x1560 mm/shmem.c:965 shmem_truncate_range mm/shmem.c:1064 [inline] shmem_evict_inode+0x215/0x9d0 mm/shmem.c:1146 evict+0x2a3/0x630 fs/inode.c:587 iput_final fs/inode.c:1663 [inline] iput+0x63b/0x7e0 fs/inode.c:1689 dentry_unlink_inode+0x34f/0x440 fs/dcache.c:376 __dentry_kill+0x447/0x660 fs/dcache.c:582 dentry_kill+0xc0/0x2a0 dput+0x165/0x320 fs/dcache.c:888 do_renameat2+0xc1c/0x1480 fs/namei.c:4889 Memory state around the buggy address: ffff88816dff5480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88816dff5500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88816dff5580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88816dff5600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88816dff5680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================