BUG: sleeping function called from invalid context at include/linux/sched/mm.h:209 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 18108, name: syz-executor.0 1 lock held by syz-executor.0/18108: #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_pte_range mm/memory.c:1331 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_pmd_range mm/memory.c:1494 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_pud_range mm/memory.c:1523 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_p4d_range mm/memory.c:1544 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: unmap_page_range+0x9c3/0x2630 mm/memory.c:1565 Preemption disabled at: [<0000000000000000>] 0x0 CPU: 0 PID: 18108 Comm: syz-executor.0 Not tainted 5.15.101-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 ___might_sleep+0x547/0x6a0 kernel/sched/core.c:9622 might_alloc include/linux/sched/mm.h:209 [inline] slab_pre_alloc_hook+0x44/0xc0 mm/slab.h:492 slab_alloc_node mm/slub.c:3134 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0x3f/0x2e0 mm/slub.c:3233 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2627 [inline] f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2637 [inline] f2fs_register_inmem_page+0x1de/0x7c0 fs/f2fs/segment.c:192 f2fs_set_data_page_dirty+0x875/0xb80 fs/f2fs/data.c:3781 zap_pte_range mm/memory.c:1366 [inline] zap_pmd_range mm/memory.c:1494 [inline] zap_pud_range mm/memory.c:1523 [inline] zap_p4d_range mm/memory.c:1544 [inline] unmap_page_range+0xdcd/0x2630 mm/memory.c:1565 unmap_vmas+0x1f8/0x390 mm/memory.c:1642 exit_mmap+0x3b6/0x670 mm/mmap.c:3186 __mmput+0x112/0x3b0 kernel/fork.c:1118 exit_mm+0x688/0x7f0 kernel/exit.c:548 do_exit+0x626/0x2480 kernel/exit.c:859 do_group_exit+0x144/0x310 kernel/exit.c:994 __do_sys_exit_group kernel/exit.c:1005 [inline] __se_sys_exit_group kernel/exit.c:1003 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1003 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fb0595850f9 Code: Unable to access opcode bytes at RIP 0x7fb0595850cf. RSP: 002b:00007ffd1ed30d08 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007fb0595850f9 RDX: 00007fb059536fab RSI: ffffffffffffffb8 RDI: 0000000000000000 RBP: 0000000000000001 R08: 000000002dacfccc R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000001 R15: 00007ffd1ed30df0 ============================= [ BUG: Invalid wait context ] 5.15.101-syzkaller #0 Tainted: G W ----------------------------- syz-executor.0/18108 is trying to lock: ffff888026ad9998 (&fi->inmem_lock){+.+.}-{3:3}, at: f2fs_register_inmem_page+0x30c/0x7c0 fs/f2fs/segment.c:201 other info that might help us debug this: context-{4:4} 1 lock held by syz-executor.0/18108: #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_pte_range mm/memory.c:1331 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_pmd_range mm/memory.c:1494 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_pud_range mm/memory.c:1523 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: zap_p4d_range mm/memory.c:1544 [inline] #0: ffff8880135f5798 (ptlock_ptr(page)#2){+.+.}-{2:2}, at: unmap_page_range+0x9c3/0x2630 mm/memory.c:1565 stack backtrace: CPU: 0 PID: 18108 Comm: syz-executor.0 Tainted: G W 5.15.101-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_lock_invalid_wait_context kernel/locking/lockdep.c:4663 [inline] check_wait_context kernel/locking/lockdep.c:4724 [inline] __lock_acquire+0x14f5/0x1ff0 kernel/locking/lockdep.c:4961 lock_acquire+0x1ff/0x570 kernel/locking/lockdep.c:5622 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596 __mutex_lock kernel/locking/mutex.c:729 [inline] mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743 f2fs_register_inmem_page+0x30c/0x7c0 fs/f2fs/segment.c:201 f2fs_set_data_page_dirty+0x875/0xb80 fs/f2fs/data.c:3781 zap_pte_range mm/memory.c:1366 [inline] zap_pmd_range mm/memory.c:1494 [inline] zap_pud_range mm/memory.c:1523 [inline] zap_p4d_range mm/memory.c:1544 [inline] unmap_page_range+0xdcd/0x2630 mm/memory.c:1565 unmap_vmas+0x1f8/0x390 mm/memory.c:1642 exit_mmap+0x3b6/0x670 mm/mmap.c:3186 __mmput+0x112/0x3b0 kernel/fork.c:1118 exit_mm+0x688/0x7f0 kernel/exit.c:548 do_exit+0x626/0x2480 kernel/exit.c:859 do_group_exit+0x144/0x310 kernel/exit.c:994 __do_sys_exit_group kernel/exit.c:1005 [inline] __se_sys_exit_group kernel/exit.c:1003 [inline] __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1003 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7fb0595850f9 Code: Unable to access opcode bytes at RIP 0x7fb0595850cf. RSP: 002b:00007ffd1ed30d08 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007fb0595850f9 RDX: 00007fb059536fab RSI: ffffffffffffffb8 RDI: 0000000000000000 RBP: 0000000000000001 R08: 000000002dacfccc R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 0000000000000000 R14: 0000000000000001 R15: 00007ffd1ed30df0