R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000002 R13: 00007fd5cd026038 R14: 00007fd5cd025fa0 R15: 00007ffe0b72ddb8 ================================================================== BUG: KASAN: slab-use-after-free in jffs2_xattr_delete_inode+0x112/0x130 fs/jffs2/xattr.c:602 Read of size 4 at addr ffff88803fa26ae8 by task syz.8.4362/19151 CPU: 1 UID: 0 PID: 19151 Comm: syz.8.4362 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:825 iput_final fs/inode.c:2019 [inline] iput.part.0+0x989/0x1050 fs/inode.c:2068 iput+0x35/0x40 fs/inode.c:2034 jffs2_new_inode+0xa75/0xcc0 fs/jffs2/fs.c:470 jffs2_create+0x94/0x390 fs/jffs2/dir.c:182 lookup_open fs/namei.c:4508 [inline] open_last_lookups fs/namei.c:4608 [inline] path_openat+0x341f/0x4280 fs/namei.c:4860 do_file_open+0x20e/0x430 fs/namei.c:4892 do_sys_openat2+0x10f/0x1e0 fs/open.c:1368 do_sys_open fs/open.c:1374 [inline] __do_sys_openat fs/open.c:1390 [inline] __se_sys_openat fs/open.c:1385 [inline] __x64_sys_openat+0x12d/0x210 fs/open.c:1385 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fd5ccd9e0d9 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fd5cdd49028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fd5cd025fa0 RCX: 00007fd5ccd9e0d9 RDX: 0000000000000042 RSI: 0000200000001100 RDI: ffffffffffffff9c RBP: 00007fd5cdd49090 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000002 R13: 00007fd5cd026038 R14: 00007fd5cd025fa0 R15: 00007ffe0b72ddb8 Allocated by task 14571: 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:4584 [inline] slab_alloc_node mm/slub.c:4917 [inline] kmem_cache_alloc_noprof+0x26b/0x6a0 mm/slub.c:4931 jffs2_scan_make_ino_cache+0x86/0x180 fs/jffs2/scan.c:978 jffs2_sum_process_sum_data fs/jffs2/summary.c:467 [inline] jffs2_sum_scan_sumnode+0x1127/0x1e30 fs/jffs2/summary.c:640 jffs2_scan_eraseblock fs/jffs2/scan.c:546 [inline] jffs2_scan_medium+0x17e3/0x59d0 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/0xa60 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+0x1e0/0x8a0 drivers/mtd/mtdsuper.c:158 vfs_get_tree+0x92/0x320 fs/super.c:1700 fc_mount fs/namespace.c:1198 [inline] do_new_mount_fc fs/namespace.c:3765 [inline] do_new_mount fs/namespace.c:3841 [inline] path_mount+0x7d0/0x23d0 fs/namespace.c:4161 do_mount fs/namespace.c:4174 [inline] __do_sys_mount fs/namespace.c:4390 [inline] __se_sys_mount fs/namespace.c:4367 [inline] __x64_sys_mount+0x293/0x310 fs/namespace.c:4367 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 12947: 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:2677 [inline] slab_free mm/slub.c:6377 [inline] kmem_cache_free+0x127/0x6b0 mm/slub.c:6504 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:647 kill_mtd_super+0x1d/0x80 drivers/mtd/mtdsuper.c:174 jffs2_kill_sb+0x7c/0xb0 fs/jffs2/super.c:350 deactivate_locked_super+0xc1/0x1b0 fs/super.c:477 deactivate_super fs/super.c:510 [inline] deactivate_super+0xe7/0x110 fs/super.c:506 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/0x6f0 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:318 [inline] do_syscall_64+0x666/0x870 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88803fa26ac0 which belongs to the cache jffs2_inode_cache of size 48 The buggy address is located 40 bytes inside of freed 48-byte region [ffff88803fa26ac0, ffff88803fa26af0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88803fa267c0 pfn:0x3fa26 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88802550cb40 ffffea00004d8050 ffffea0000aaa950 raw: ffff88803fa267c0 0000000800400029 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 13365, tgid 13364 (syz.4.2376), ts 230460938706, free_ts 230457103465 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1859 prep_new_page mm/page_alloc.c:1867 [inline] get_page_from_freelist+0xf48/0x3530 mm/page_alloc.c:3946 __alloc_frozen_pages_noprof+0x299/0x2dc0 mm/page_alloc.c:5304 alloc_slab_page mm/slub.c:3266 [inline] allocate_slab mm/slub.c:3380 [inline] new_slab+0xa2/0x640 mm/slub.c:3426 refill_objects+0xe3/0x410 mm/slub.c:7310 refill_sheaf mm/slub.c:2804 [inline] __pcs_replace_empty_main+0x376/0x680 mm/slub.c:4675 alloc_from_pcs mm/slub.c:4773 [inline] slab_alloc_node mm/slub.c:4905 [inline] kmem_cache_alloc_noprof+0x46e/0x6a0 mm/slub.c:4931 jffs2_do_new_inode+0x24/0x520 fs/jffs2/write.c:28 jffs2_new_inode+0x581/0xcc0 fs/jffs2/fs.c:466 jffs2_create+0x94/0x390 fs/jffs2/dir.c:182 lookup_open fs/namei.c:4508 [inline] open_last_lookups fs/namei.c:4608 [inline] path_openat+0x341f/0x4280 fs/namei.c:4860 do_file_open+0x20e/0x430 fs/namei.c:4892 do_sys_openat2+0x10f/0x1e0 fs/open.c:1368 do_sys_open fs/open.c:1374 [inline] __do_sys_openat fs/open.c:1390 [inline] __se_sys_openat fs/open.c:1385 [inline] __x64_sys_openat+0x12d/0x210 fs/open.c:1385 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5127 tgid 5127 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1406 [inline] __free_frozen_pages+0x79f/0x1090 mm/page_alloc.c:2950 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4584 [inline] slab_alloc_node mm/slub.c:4917 [inline] kmem_cache_alloc_node_noprof+0x27d/0x6b0 mm/slub.c:4989 __alloc_skb+0x140/0x710 net/core/skbuff.c:704 alloc_skb include/linux/skbuff.h:1384 [inline] alloc_skb_with_frags+0xdd/0x760 net/core/skbuff.c:6775 sock_alloc_send_pskb+0x801/0x980 net/core/sock.c:3012 unix_dgram_sendmsg+0x3c7/0x1810 net/unix/af_unix.c:2137 sock_sendmsg_nosec net/socket.c:775 [inline] __sock_sendmsg net/socket.c:790 [inline] __sys_sendto+0x48b/0x4e0 net/socket.c:2252 __do_sys_sendto net/socket.c:2259 [inline] __se_sys_sendto net/socket.c:2255 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2255 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88803fa26980: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ffff88803fa26a00: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc >ffff88803fa26a80: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ^ ffff88803fa26b00: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ffff88803fa26b80: fa fb fb fb fb fb fc fc fa fb fb fb fb fb fc fc ==================================================================