ubi0: attaching mtd0 ubi0: scanning is finished ================================================================== BUG: KASAN: use-after-free in notifier_chain_register+0x3ac/0x420 kernel/notifier.c:27 Read of size 4 at addr ffff888068be98d8 by task syz.1.886/9169 CPU: 1 UID: 0 PID: 9169 Comm: syz.1.886 Not tainted 6.13.0-syzkaller-08291-g805ba04cb7cc #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 notifier_chain_register+0x3ac/0x420 kernel/notifier.c:27 __blocking_notifier_chain_register kernel/notifier.c:264 [inline] blocking_notifier_chain_register+0x76/0xd0 kernel/notifier.c:282 ubi_wl_init+0x1018/0x17b0 drivers/mtd/ubi/wl.c:1960 ubi_attach+0x1cdd/0x4dc0 drivers/mtd/ubi/attach.c:1605 ubi_attach_mtd_dev+0x158f/0x3590 drivers/mtd/ubi/build.c:1004 ctrl_cdev_ioctl+0x339/0x3d0 drivers/mtd/ubi/cdev.c:1043 compat_ptr_ioctl+0x6b/0xa0 fs/ioctl.c:943 __do_compat_sys_ioctl+0x1cb/0x2c0 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7faf579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f508455c EFLAGS: 00000296 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 000000000000000d RCX: 0000000040186f40 RDX: 0000000020000502 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888000000004 pfn:0x68be9 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000000 0000000000000000 ffffffffffffffff 0000000000000000 raw: ffff888000000004 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x452cc0(GFP_KERNEL_ACCOUNT|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 9117, tgid 9116 (syz.3.871), ts 199557813723, free_ts 199634247707 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x221/0x2470 mm/page_alloc.c:4739 __alloc_pages_noprof+0xb/0x1b0 mm/page_alloc.c:4773 __alloc_pages_node_noprof include/linux/gfp.h:265 [inline] alloc_pages_node_noprof include/linux/gfp.h:292 [inline] ___kmalloc_large_node+0x84/0x1b0 mm/slub.c:4239 __kmalloc_large_node_noprof+0x1c/0x70 mm/slub.c:4266 __do_kmalloc_node mm/slub.c:4282 [inline] __kmalloc_node_noprof.cold+0x5/0x5f mm/slub.c:4300 __kvmalloc_node_noprof+0x6f/0x1a0 mm/util.c:662 kvmalloc_array_node_noprof include/linux/slab.h:1063 [inline] io_alloc_hash_table io_uring/io_uring.c:270 [inline] io_ring_ctx_alloc io_uring/io_uring.c:304 [inline] io_uring_create io_uring/io_uring.c:3615 [inline] io_uring_setup+0x2a8/0x3370 io_uring/io_uring.c:3789 __do_sys_io_uring_setup io_uring/io_uring.c:3816 [inline] __se_sys_io_uring_setup io_uring/io_uring.c:3810 [inline] __ia32_sys_io_uring_setup+0x97/0x140 io_uring/io_uring.c:3810 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e page last free pid 11 tgid 11 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_frozen_pages+0x6db/0xfb0 mm/page_alloc.c:2660 __folio_put+0x32a/0x450 mm/swap.c:112 kvfree+0x47/0x50 mm/util.c:705 io_ring_ctx_free io_uring/io_uring.c:2734 [inline] io_ring_exit_work+0xe96/0x1ba0 io_uring/io_uring.c:2937 process_one_work+0x958/0x1b30 kernel/workqueue.c:3236 process_scheduled_works kernel/workqueue.c:3317 [inline] worker_thread+0x6c8/0xf00 kernel/workqueue.c:3398 kthread+0x3af/0x750 kernel/kthread.c:464 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff888068be9780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888068be9800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888068be9880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888068be9900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888068be9980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi