================================================================== BUG: KASAN: slab-use-after-free in jffs2_xattr_delete_inode+0x112/0x130 fs/jffs2/xattr.c:602 Read of size 4 at addr ffff888012ed8e68 by task syz.5.1584/11314 CPU: 3 UID: 60928 PID: 11314 Comm: syz.5.1584 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 jffs2_xattr_delete_inode+0x112/0x130 fs/jffs2/xattr.c:602 jffs2_do_clear_inode+0x50/0x470 fs/jffs2/readinode.c:1418 evict+0x3c2/0xad0 fs/inode.c:822 iput_final fs/inode.c:2015 [inline] iput.part.0+0x989/0x1050 fs/inode.c:2064 iput+0x35/0x40 fs/inode.c:2030 jffs2_new_inode+0xaa3/0xcf0 fs/jffs2/fs.c:470 jffs2_create+0x94/0x390 fs/jffs2/dir.c:182 lookup_open+0x1255/0x1990 fs/namei.c:4567 open_last_lookups fs/namei.c:4767 [inline] path_openat+0xa2c/0x2440 fs/namei.c:4997 do_file_open+0x20e/0x430 fs/namei.c:5029 do_sys_openat2+0x10f/0x1e0 fs/open.c:1417 do_sys_open fs/open.c:1423 [inline] __do_compat_sys_openat fs/open.c:1485 [inline] __se_compat_sys_openat fs/open.c:1483 [inline] __ia32_compat_sys_openat+0x12d/0x210 fs/open.c:1483 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf705efec Code: Unable to access opcode bytes at 0xf705efc2. RSP: 002b:00000000f544d50c EFLAGS: 00000292 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 0000000080000500 RDX: 0000000000000042 RSI: 00000000000001ff RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 6689: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 unpoison_slab_object mm/kasan/common.c:340 [inline] __kasan_slab_alloc+0x89/0x90 mm/kasan/common.c:366 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4683 [inline] slab_alloc_node mm/slub.c:4996 [inline] kmem_cache_alloc_noprof+0x269/0x6a0 mm/slub.c:5010 jffs2_scan_make_ino_cache+0x86/0x180 fs/jffs2/scan.c:978 jffs2_sum_process_sum_data fs/jffs2/summary.c:418 [inline] jffs2_sum_scan_sumnode+0x62c/0x1e30 fs/jffs2/summary.c:640 jffs2_scan_eraseblock fs/jffs2/scan.c:546 [inline] jffs2_scan_medium+0x17db/0x59c0 fs/jffs2/scan.c:151 jffs2_build_filesystem fs/jffs2/build.c:112 [inline] jffs2_do_mount_fs+0x8a0/0x2300 fs/jffs2/build.c:416 jffs2_do_fill_super+0x3d4/0xa50 fs/jffs2/fs.c:574 jffs2_fill_super+0x283/0x370 fs/jffs2/super.c:290 mtd_get_sb+0x2f0/0x4c0 drivers/mtd/mtdsuper.c:57 mtd_get_sb_by_nr drivers/mtd/mtdsuper.c:88 [inline] get_tree_mtd+0x6f9/0x8a0 drivers/mtd/mtdsuper.c:141 vfs_get_tree+0x92/0x320 fs/super.c:1947 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3772 [inline] do_new_mount fs/namespace.c:3848 [inline] path_mount+0x7d0/0x24c0 fs/namespace.c:4168 do_mount fs/namespace.c:4181 [inline] __do_sys_mount fs/namespace.c:4397 [inline] __se_sys_mount fs/namespace.c:4374 [inline] __ia32_sys_mount+0x292/0x310 fs/namespace.c:4374 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x13a/0x8b0 arch/x86/entry/syscall_32.c:291 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 6689: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2748 [inline] slab_free mm/slub.c:6499 [inline] kmem_cache_free+0x127/0x6c0 mm/slub.c:6626 jffs2_free_ino_caches+0xf7/0x1c0 fs/jffs2/nodelist.c:497 jffs2_put_super+0x68/0x1b0 fs/jffs2/super.c:335 generic_shutdown_super+0x167/0x360 fs/super.c:769 kill_mtd_super+0x1d/0x80 drivers/mtd/mtdsuper.c:174 jffs2_kill_sb+0x7c/0xb0 fs/jffs2/super.c:350 deactivate_locked_super+0xbd/0x140 fs/super.c:603 deactivate_super fs/super.c:632 [inline] deactivate_super+0xea/0x110 fs/super.c:628 cleanup_mnt+0x21f/0x450 fs/namespace.c:1317 task_work_run+0x150/0x240 kernel/task_work.c:233 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] __exit_to_user_mode_loop kernel/entry/common.c:70 [inline] exit_to_user_mode_loop+0x1d8/0x700 kernel/entry/common.c:101 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:207 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:230 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:336 [inline] __do_fast_syscall_32+0x59f/0x8b0 arch/x86/entry/syscall_32.c:294 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:316 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888012ed8e40 which belongs to the cache jffs2_inode_cache of size 48 The buggy address is located 40 bytes inside of freed 48-byte region [ffff888012ed8e40, ffff888012ed8e70) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12ed8 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff888040b07a40 dead000000000100 dead000000000122 raw: 0000000000000000 0000000200400040 00000000f5000000 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 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6064, tgid 6061 (syz.1.42), ts 53570564185 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab mm/slub.c:3462 [inline] new_slab+0xa9/0x6e0 mm/slub.c:3513 refill_objects+0xe3/0x410 mm/slub.c:7410 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] kmem_cache_alloc_noprof+0x4c4/0x6a0 mm/slub.c:5010 jffs2_scan_make_ino_cache+0x86/0x180 fs/jffs2/scan.c:978 jffs2_scan_inode_node fs/jffs2/scan.c:1025 [inline] jffs2_scan_eraseblock fs/jffs2/scan.c:814 [inline] jffs2_scan_medium+0x4bb4/0x59c0 fs/jffs2/scan.c:151 jffs2_build_filesystem fs/jffs2/build.c:112 [inline] jffs2_do_mount_fs+0x8a0/0x2300 fs/jffs2/build.c:416 jffs2_do_fill_super+0x3d4/0xa50 fs/jffs2/fs.c:574 jffs2_fill_super+0x283/0x370 fs/jffs2/super.c:290 mtd_get_sb+0x2f0/0x4c0 drivers/mtd/mtdsuper.c:57 mtd_get_sb_by_nr drivers/mtd/mtdsuper.c:88 [inline] get_tree_mtd+0x6f9/0x8a0 drivers/mtd/mtdsuper.c:141 vfs_get_tree+0x92/0x320 fs/super.c:1947 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3772 [inline] do_new_mount fs/namespace.c:3848 [inline] path_mount+0x7d0/0x24c0 fs/namespace.c:4168 page last free pid 24 tgid 24 ts 52391440725 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1418 [inline] __free_frozen_pages+0x79f/0x10f0 mm/page_alloc.c:2962 __pagetable_free include/linux/mm.h:3804 [inline] pagetable_free include/linux/mm.h:3828 [inline] pagetable_dtor_free include/linux/mm.h:3927 [inline] __tlb_remove_table include/asm-generic/tlb.h:221 [inline] __tlb_remove_table_free mm/mmu_gather.c:228 [inline] tlb_remove_table_rcu+0x2cf/0x380 mm/mmu_gather.c:291 rcu_do_batch kernel/rcu/tree.c:2650 [inline] rcu_core+0x5f0/0x1260 kernel/rcu/tree.c:2919 handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645 run_ksoftirqd kernel/softirq.c:1099 [inline] run_ksoftirqd+0x38/0x60 kernel/softirq.c:1091 smpboot_thread_fn+0x3d3/0xab0 kernel/smpboot.c:160 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888012ed8d00: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ffff888012ed8d80: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc >ffff888012ed8e00: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ^ ffff888012ed8e80: 00 00 00 00 00 00 fc fc fa fb fb fb fb fb fc fc ffff888012ed8f00: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ==================================================================