BUG: sleeping function called from invalid context at ./include/linux/sched/mm.h:321 in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 6146, name: syz.1.45 preempt_count: 0, expected: 0 RCU nest depth: 1, expected: 0 4 locks held by syz.1.45/6146: #0: ffff8880247a20f8 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x2a2/0x370 fs/file.c:1213 #1: ffff88804e878148 (&type->i_mutex_dir_key#9){.+.+}-{4:4}, at: iterate_dir+0x18b/0xb40 fs/readdir.c:101 #2: ffffffff8e3bf140 (rcu_read_lock){....}-{1:3}, at: rcu_lock_acquire include/linux/rcupdate.h:331 [inline] #2: ffffffff8e3bf140 (rcu_read_lock){....}-{1:3}, at: rcu_read_lock include/linux/rcupdate.h:841 [inline] #2: ffffffff8e3bf140 (rcu_read_lock){....}-{1:3}, at: afs_dynroot_readdir+0x619/0xf50 fs/afs/dynroot.c:351 #3: ffff888026f7e5e0 (&mm->mmap_lock){++++}-{4:4}, at: mmap_read_trylock include/linux/mmap_lock.h:209 [inline] #3: ffff888026f7e5e0 (&mm->mmap_lock){++++}-{4:4}, at: get_mmap_lock_carefully mm/memory.c:6239 [inline] #3: ffff888026f7e5e0 (&mm->mmap_lock){++++}-{4:4}, at: lock_mm_and_find_vma+0x35/0x6e0 mm/memory.c:6299 CPU: 2 UID: 0 PID: 6146 Comm: syz.1.45 Not tainted 6.14.0-syzkaller-10892-g4e82c87058f4 #0 PREEMPT(full) 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+0x16c/0x1f0 lib/dump_stack.c:120 __might_resched+0x3c0/0x5e0 kernel/sched/core.c:8818 might_alloc include/linux/sched/mm.h:321 [inline] prepare_alloc_pages+0x413/0x610 mm/page_alloc.c:4574 __alloc_frozen_pages_noprof+0x18f/0x2370 mm/page_alloc.c:4795 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2301 folio_alloc_mpol_noprof+0x36/0x2f0 mm/mempolicy.c:2320 vma_alloc_folio_noprof+0xed/0x1e0 mm/mempolicy.c:2355 folio_prealloc mm/memory.c:1060 [inline] wp_page_copy mm/memory.c:3444 [inline] do_wp_page+0x1055/0x4670 mm/memory.c:3836 handle_pte_fault mm/memory.c:5906 [inline] __handle_mm_fault+0x1ae0/0x2a50 mm/memory.c:6033 handle_mm_fault+0x404/0xae0 mm/memory.c:6202 do_user_addr_fault+0x7a9/0x1430 arch/x86/mm/fault.c:1388 handle_page_fault arch/x86/mm/fault.c:1480 [inline] exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1538 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623 RIP: 0010:filldir64+0x2af/0x5e0 fs/readdir.c:371 Code: 5e 41 5f c3 cc cc cc cc e8 8e a2 84 ff 0f 01 cb 0f ae e8 48 8b 04 24 49 89 47 08 e8 7b a2 84 ff 4c 8b 7c 24 30 48 8b 74 24 10 <49> 89 37 e8 69 a2 84 ff 66 45 89 6f 10 e8 5f a2 84 ff 0f b6 7c 24 RSP: 0018:ffffc90003cffc58 EFLAGS: 00050287 RAX: 0000000000000141 RBX: ffffc90003cffe80 RCX: ffffc900072b1000 RDX: 0000000000080000 RSI: 0000000000000005 RDI: 0000000000000006 RBP: 0000200000001020 R08: 0000000000000006 R09: 0000200000000fe0 R10: 0000200000001020 R11: 0000000000000000 R12: 0000000000000006 R13: 0000000000000020 R14: ffff88802e27f040 R15: 0000200000001000 dir_emit include/linux/fs.h:3861 [inline] afs_dynroot_readdir_cells fs/afs/dynroot.c:316 [inline] afs_dynroot_readdir+0x7ed/0xf50 fs/afs/dynroot.c:352 iterate_dir+0x293/0xb40 fs/readdir.c:108 __do_sys_getdents64 fs/readdir.c:403 [inline] __se_sys_getdents64 fs/readdir.c:389 [inline] __x64_sys_getdents64+0x14d/0x2d0 fs/readdir.c:389 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x260 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f887b58d169 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f887c3b9038 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007f887b7a5fa0 RCX: 00007f887b58d169 RDX: 0000000000001000 RSI: 0000200000000f80 RDI: 0000000000000004 RBP: 00007f887b60e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f887b7a5fa0 R15: 00007ffc746f9ec8 ---------------- Code disassembly (best guess): 0: 5e pop %rsi 1: 41 5f pop %r15 3: c3 ret 4: cc int3 5: cc int3 6: cc int3 7: cc int3 8: e8 8e a2 84 ff call 0xff84a29b d: 0f 01 cb stac 10: 0f ae e8 lfence 13: 48 8b 04 24 mov (%rsp),%rax 17: 49 89 47 08 mov %rax,0x8(%r15) 1b: e8 7b a2 84 ff call 0xff84a29b 20: 4c 8b 7c 24 30 mov 0x30(%rsp),%r15 25: 48 8b 74 24 10 mov 0x10(%rsp),%rsi * 2a: 49 89 37 mov %rsi,(%r15) <-- trapping instruction 2d: e8 69 a2 84 ff call 0xff84a29b 32: 66 45 89 6f 10 mov %r13w,0x10(%r15) 37: e8 5f a2 84 ff call 0xff84a29b 3c: 0f .byte 0xf 3d: b6 7c mov $0x7c,%dh 3f: 24 .byte 0x24