======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.6.799/8402 is trying to acquire lock:
ffff888025ce8480 (&of->mutex){+.+.}-{4:4}, at: kernfs_seq_start+0x5d/0x420

but task is already holding lock:
ffff88810530e098 (&p->lock){+.+.}-{4:4}, at: seq_read_iter+0xa4/0xca0

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&p->lock){+.+.}-{4:4}:
       __mutex_lock+0x197/0x15a0
       seq_read_iter+0xa4/0xca0
       proc_reg_read_iter+0x1b7/0x280
       copy_splice_read+0x5ff/0xaa0
       splice_file_to_pipe+0x4ab/0x720
       do_splice+0x124f/0x1a60
       __se_sys_splice+0x353/0x490
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&pipe->mutex){+.+.}-{4:4}:
       __mutex_lock+0x197/0x15a0
       anon_pipe_write+0x28f/0x1a90
       __kernel_write_iter+0x44a/0x8f0
       __kernel_write+0x106/0x170
       autofs_notify_daemon+0x770/0xf10
       autofs_wait+0x11ad/0x18a0
       autofs_mount_wait+0x16b/0x390
       autofs_d_automount+0x64e/0x810
       __traverse_mounts+0x2fe/0x5d0
       step_into_slowpath+0x4ba/0x820
       path_lookupat+0x433/0x8c0
       filename_lookup+0x265/0x5d0
       kern_path+0x3d/0x150
       lookup_bdev+0xc8/0x2b0
       resume_store+0x181/0x500
       kernfs_fop_write_iter+0x3a4/0x540
       vfs_write+0x612/0xba0
       ksys_write+0x150/0x270
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&sbi->pipe_mutex){+.+.}-{4:4}:
       __mutex_lock+0x197/0x15a0
       autofs_notify_daemon+0x75d/0xf10
       autofs_wait+0x11ad/0x18a0
       autofs_mount_wait+0x16b/0x390
       autofs_d_automount+0x64e/0x810
       __traverse_mounts+0x2fe/0x5d0
       step_into_slowpath+0x4ba/0x820
       path_lookupat+0x433/0x8c0
       filename_lookup+0x265/0x5d0
       kern_path+0x3d/0x150
       lookup_bdev+0xc8/0x2b0
       resume_store+0x181/0x500
       kernfs_fop_write_iter+0x3a4/0x540
       vfs_write+0x612/0xba0
       ksys_write+0x150/0x270
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&of->mutex){+.+.}-{4:4}:
       __lock_acquire+0x164c/0x2de0
       lock_acquire+0x115/0x350
       __mutex_lock+0x197/0x15a0
       kernfs_seq_start+0x5d/0x420
       seq_read_iter+0x37e/0xca0
       copy_splice_read+0x5ff/0xaa0
       splice_direct_to_actor+0x48b/0xcb0
       do_splice_direct+0x195/0x290
       do_sendfile+0x52e/0x7c0
       __se_sys_sendfile64+0x144/0x1a0
       do_syscall_64+0x166/0x520
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  &of->mutex --> &pipe->mutex --> &p->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&p->lock);
                               lock(&pipe->mutex);
                               lock(&p->lock);
  lock(&of->mutex);

 *** DEADLOCK ***

locks held by syz.6.799/8402: 1, last CPU#0:
 #0: ffff88810530e098 (&p->lock){+.+.}-{4:4}, at: seq_read_iter+0xa4/0xca0

stack backtrace:
CPU: 0 UID: 0 PID: 8402 Comm: syz.6.799 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 print_circular_bug+0x2e2/0x300
 check_noncircular+0x12f/0x150
 __lock_acquire+0x164c/0x2de0
 lock_acquire+0x115/0x350
 __mutex_lock+0x197/0x15a0
 kernfs_seq_start+0x5d/0x420
 seq_read_iter+0x37e/0xca0
 copy_splice_read+0x5ff/0xaa0
 splice_direct_to_actor+0x48b/0xcb0
 do_splice_direct+0x195/0x290
 do_sendfile+0x52e/0x7c0
 __se_sys_sendfile64+0x144/0x1a0
 do_syscall_64+0x166/0x520
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe205f9fb19
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:00007fe206e7f028 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fe206225fa0 RCX: 00007fe205f9fb19
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000008
RBP: 00007fe206037b70 R08: 0000000000000000 R09: 0000000000000000
R10: 7fffffffffffffff R11: 0000000000000246 R12: 0000000000000000
R13: 00007fe206226038 R14: 00007fe206225fa0 R15: 00007ffef5877d08
 </TASK>
WARNING! power/level is deprecated; use power/control instead
