================================================================== BUG: KASAN: slab-use-after-free in __list_del_entry_valid_or_report+0x13e/0x1b0 lib/list_debug.c:49 Read of size 8 at addr ffff88801ca210b0 by task kworker/u16:5/1084 CPU: 3 PID: 1084 Comm: kworker/u16:5 Not tainted 6.6.0-syzkaller-13878-g2c40c1c6adab #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Workqueue: btrfs-qgroup-rescan btrfs_work_helper 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 __list_del_entry_valid_or_report+0x13e/0x1b0 lib/list_debug.c:49 __list_del_entry_valid include/linux/list.h:124 [inline] __list_del_entry include/linux/list.h:215 [inline] list_del_init include/linux/list.h:287 [inline] qgroup_iterator_nested_clean fs/btrfs/qgroup.c:2623 [inline] btrfs_qgroup_account_extent+0x795/0x1020 fs/btrfs/qgroup.c:2883 qgroup_rescan_leaf+0x6b4/0xc20 fs/btrfs/qgroup.c:3543 btrfs_qgroup_rescan_worker+0x43a/0xa00 fs/btrfs/qgroup.c:3604 btrfs_work_helper+0x210/0xbe0 fs/btrfs/async-thread.c:315 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Allocated by task 18095: 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:600 [inline] kzalloc include/linux/slab.h:721 [inline] btrfs_quota_enable+0xb0b/0x1eb0 fs/btrfs/qgroup.c:1209 btrfs_ioctl_quota_ctl fs/btrfs/ioctl.c:3705 [inline] btrfs_ioctl+0x4caf/0x5d90 fs/btrfs/ioctl.c:4668 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:871 [inline] __se_sys_ioctl fs/ioctl.c:857 [inline] __x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:857 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b Freed by task 18095: 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+0x138/0x190 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] __cache_free mm/slab.c:3370 [inline] __do_kmem_cache_free mm/slab.c:3557 [inline] __kmem_cache_free+0xcc/0x3d0 mm/slab.c:3564 btrfs_remove_qgroup+0x541/0x7c0 fs/btrfs/qgroup.c:1787 btrfs_ioctl_qgroup_create fs/btrfs/ioctl.c:3811 [inline] btrfs_ioctl+0x5042/0x5d90 fs/btrfs/ioctl.c:4672 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:871 [inline] __se_sys_ioctl fs/ioctl.c:857 [inline] __x64_sys_ioctl+0x18f/0x210 fs/ioctl.c:857 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2667 pwq_release_workfn+0x244/0x380 kernel/workqueue.c:4138 kthread_worker_fn+0x2ff/0xac0 kernel/kthread.c:841 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492 __call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2667 pwq_release_workfn+0x244/0x380 kernel/workqueue.c:4138 kthread_worker_fn+0x2ff/0xac0 kernel/kthread.c:841 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242 The buggy address belongs to the object at ffff88801ca21000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 176 bytes inside of freed 512-byte region [ffff88801ca21000, ffff88801ca21200) The buggy address belongs to the physical page: page:ffffea0000728840 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ca21 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0x4() raw: 00fff00000000800 ffff888013040600 ffffea000084e850 ffffea00009b8ad0 raw: 0000000000000000 ffff88801ca21000 0000000100000004 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 4663, tgid 4663 (udevd), ts 186027442555, free_ts 186027332507 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1544 [inline] get_page_from_freelist+0xa25/0x36c0 mm/page_alloc.c:3312 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4568 __alloc_pages_node include/linux/gfp.h:238 [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+0x3ba/0x460 mm/slab.c:3521 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1098 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:721 [inline] kernfs_fop_open+0x318/0xe00 fs/kernfs/file.c:621 do_dentry_open+0x8d4/0x18d0 fs/open.c:948 do_open fs/namei.c:3622 [inline] path_openat+0x1d4e/0x2c40 fs/namei.c:3779 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 fs/open.c:1440 do_sys_open fs/open.c:1455 [inline] __do_sys_openat fs/open.c:1471 [inline] __se_sys_openat fs/open.c:1466 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1466 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1137 [inline] free_unref_page_prepare+0x4f8/0xa90 mm/page_alloc.c:2347 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2487 selinux_genfs_get_sid security/selinux/hooks.c:1341 [inline] inode_doinit_with_dentry+0xac0/0x12c0 security/selinux/hooks.c:1539 selinux_d_instantiate+0x26/0x30 security/selinux/hooks.c:6284 security_d_instantiate+0x54/0xe0 security/security.c:3799 d_splice_alias+0x94/0xdf0 fs/dcache.c:3145 kernfs_iop_lookup+0x283/0x330 fs/kernfs/dir.c:1208 lookup_open.isra.0+0x926/0x13b0 fs/namei.c:3455 open_last_lookups fs/namei.c:3546 [inline] path_openat+0xa57/0x2c40 fs/namei.c:3776 do_filp_open+0x1de/0x430 fs/namei.c:3809 do_sys_openat2+0x176/0x1e0 fs/open.c:1440 do_sys_open fs/open.c:1455 [inline] __do_sys_openat fs/open.c:1471 [inline] __se_sys_openat fs/open.c:1466 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1466 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3f/0x110 arch/x86/entry/common.c:82 entry_SYSCALL_64_after_hwframe+0x63/0x6b Memory state around the buggy address: ffff88801ca20f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88801ca21000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88801ca21080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801ca21100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88801ca21180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================