================================================================== BUG: KASAN: use-after-free in xfs_qm_dqfree_one+0x181/0x1a0 fs/xfs/xfs_qm.c:1604 Read of size 4 at addr ffff88807319905c by task syz-executor.4/15488 CPU: 0 PID: 15488 Comm: syz-executor.4 Not tainted 6.1.0-rc8-syzkaller-00014-g8ed710da2873 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbf/0x1f0 mm/kasan/report.c:495 xfs_qm_dqfree_one+0x181/0x1a0 fs/xfs/xfs_qm.c:1604 xfs_qm_shrink_scan fs/xfs/xfs_qm.c:523 [inline] xfs_qm_shrink_scan+0x291/0x370 fs/xfs/xfs_qm.c:495 do_shrink_slab+0x464/0xce0 mm/vmscan.c:842 shrink_slab+0x175/0x660 mm/vmscan.c:1002 drop_slab_node mm/vmscan.c:1037 [inline] drop_slab+0x108/0x290 mm/vmscan.c:1047 drop_caches_sysctl_handler+0xfa/0x110 fs/drop_caches.c:66 proc_sys_call_handler+0x49c/0x6d0 fs/proc/proc_sysctl.c:604 call_write_iter include/linux/fs.h:2199 [inline] do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:735 do_iter_write+0x182/0x700 fs/read_write.c:861 vfs_iter_write+0x74/0xa0 fs/read_write.c:902 iter_file_splice_write+0x745/0xc90 fs/splice.c:686 do_splice_from fs/splice.c:764 [inline] direct_splice_actor+0x114/0x180 fs/splice.c:931 splice_direct_to_actor+0x335/0x8a0 fs/splice.c:886 do_splice_direct+0x1ab/0x280 fs/splice.c:974 do_sendfile+0xb19/0x1270 fs/read_write.c:1255 __do_sys_sendfile64 fs/read_write.c:1317 [inline] __se_sys_sendfile64 fs/read_write.c:1309 [inline] __x64_sys_sendfile64+0x14d/0x210 fs/read_write.c:1309 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f44ac28c0d9 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:00007f44ad04a168 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 00007f44ac3abf80 RCX: 00007f44ac28c0d9 RDX: 0000000020002080 RSI: 0000000000000004 RDI: 0000000000000005 RBP: 00007f44ac2e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000870 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffdb93fbe1f R14: 00007f44ad04a300 R15: 0000000000022000 Allocated by task 15499: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x2b4/0x3d0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:679 [inline] xfs_dquot_alloc+0x2a/0x690 fs/xfs/xfs_dquot.c:475 xfs_qm_dqread+0x7b/0x810 fs/xfs/xfs_dquot.c:659 xfs_qm_dqget+0x141/0x7a0 fs/xfs/xfs_dquot.c:870 xfs_qm_vop_dqalloc+0x5f2/0xfc0 fs/xfs/xfs_qm.c:1704 xfs_setattr_nonsize+0xc35/0xec0 fs/xfs/xfs_iops.c:702 xfs_vn_setattr+0x352/0x8d0 fs/xfs/xfs_iops.c:1022 notify_change+0xcd4/0x1440 fs/attr.c:420 chown_common+0x62b/0x720 fs/open.c:736 do_fchownat+0x12a/0x1e0 fs/open.c:767 __do_sys_chown fs/open.c:787 [inline] __se_sys_chown fs/open.c:785 [inline] __x64_sys_chown+0x7b/0xc0 fs/open.c:785 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 3678: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0xee/0x5c0 mm/slub.c:3683 xfs_qm_dqpurge+0x466/0x630 fs/xfs/xfs_qm.c:177 xfs_qm_dquot_walk.isra.0+0x1be/0x3f0 fs/xfs/xfs_qm.c:87 xfs_qm_dqpurge_all fs/xfs/xfs_qm.c:193 [inline] xfs_qm_unmount+0x92/0x1a0 fs/xfs/xfs_qm.c:205 xfs_unmountfs+0xbe/0x1d0 fs/xfs/xfs_mount.c:1059 xfs_fs_put_super+0x77/0x3a0 fs/xfs/xfs_super.c:1115 generic_shutdown_super+0x158/0x410 fs/super.c:492 kill_block_super+0x9b/0xf0 fs/super.c:1428 deactivate_locked_super+0x98/0x160 fs/super.c:332 deactivate_super+0xb1/0xd0 fs/super.c:363 cleanup_mnt+0x2ae/0x3d0 fs/namespace.c:1186 task_work_run+0x16f/0x270 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+0x23c/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888073199040 which belongs to the cache xfs_dquot of size 704 The buggy address is located 28 bytes inside of 704-byte region [ffff888073199040, ffff888073199300) The buggy address belongs to the physical page: page:ffffea0001cc6600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73198 head:ffffea0001cc6600 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88801c217000 raw: 0000000000000000 0000000080130013 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 15454, tgid 15453 (syz-executor.2), ts 2020035673910, free_ts 1931957387553 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4291 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5558 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x25f/0x350 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x31a/0x3d0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:679 [inline] xfs_dquot_alloc+0x2a/0x690 fs/xfs/xfs_dquot.c:475 xfs_qm_dqread+0x7b/0x810 fs/xfs/xfs_dquot.c:659 xfs_qm_dqget_inode+0x1fd/0x9f0 fs/xfs/xfs_dquot.c:973 xfs_qm_dqattach_one+0x2a8/0x760 fs/xfs/xfs_qm.c:277 xfs_qm_dqattach_locked+0x1f7/0x2c0 fs/xfs/xfs_qm.c:336 xfs_qm_vop_dqalloc+0x35b/0xfc0 fs/xfs/xfs_qm.c:1659 xfs_setattr_nonsize+0xc35/0xec0 fs/xfs/xfs_iops.c:702 xfs_vn_setattr+0x352/0x8d0 fs/xfs/xfs_iops.c:1022 notify_change+0xcd4/0x1440 fs/attr.c:420 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x1d/0x4d0 mm/page_alloc.c:3483 __stack_depot_save+0x16d/0x560 lib/stackdepot.c:506 kasan_save_stack+0x35/0x40 mm/kasan/common.c:46 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0xaf/0x3b0 mm/slub.c:3674 kobject_uevent_env+0x2a3/0x1620 lib/kobject_uevent.c:626 device_del+0x7f5/0xc80 drivers/base/core.c:3713 device_unregister+0x1e/0xc0 drivers/base/core.c:3736 device_destroy+0x9a/0xd0 drivers/base/core.c:4302 drop_ref+0xd9/0x390 drivers/hid/hidraw.c:327 hidraw_disconnect+0x4c/0x70 drivers/hid/hidraw.c:601 hid_disconnect+0x134/0x1b0 drivers/hid/hid-core.c:2256 Memory state around the buggy address: ffff888073198f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888073198f80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff888073199000: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ^ ffff888073199080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888073199100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================