====================================================== WARNING: possible circular locking dependency detected 5.15.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/8571 is trying to acquire lock: ffff888041602938 ((wq_completion)loop3){+.+.}-{0:0}, at: flush_workqueue+0x172/0x16b0 kernel/workqueue.c:2818 but task is already holding lock: ffff88801acf1b60 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x6d/0x9b0 drivers/block/loop.c:1106 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #7 (&lo->lo_mutex){+.+.}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 __mutex_lock_common+0x1d5/0x2590 kernel/locking/mutex.c:607 __mutex_lock kernel/locking/mutex.c:740 [inline] mutex_lock_killable_nested+0x1a/0x20 kernel/locking/mutex.c:807 lo_open+0x68/0x100 drivers/block/loop.c:1733 blkdev_get_whole+0x8c/0x3d0 block/bdev.c:671 blkdev_get_by_dev+0x298/0xb80 block/bdev.c:826 blkdev_open+0x137/0x2f0 block/fops.c:501 do_dentry_open+0x78b/0x1020 fs/open.c:822 do_open fs/namei.c:3426 [inline] path_openat+0x2896/0x3660 fs/namei.c:3559 do_filp_open+0x277/0x4f0 fs/namei.c:3586 do_sys_openat2+0x13b/0x500 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_open fs/open.c:1236 [inline] __se_sys_open fs/open.c:1232 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1232 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #6 (&disk->open_mutex){+.+.}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 __mutex_lock_common+0x1d5/0x2590 kernel/locking/mutex.c:607 __mutex_lock kernel/locking/mutex.c:740 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:792 bd_register_pending_holders+0x32/0x370 block/holder.c:161 device_add_disk+0x4e5/0xe50 block/genhd.c:478 add_disk include/linux/genhd.h:212 [inline] nbd_dev_add+0x6da/0x960 drivers/block/nbd.c:1819 nbd_genl_connect+0xa66/0x1f50 drivers/block/nbd.c:1947 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0x1032/0x1480 net/netlink/genetlink.c:792 netlink_rcv_skb+0x200/0x470 net/netlink/af_netlink.c:2491 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x814/0x9f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0xa20/0xe40 net/netlink/af_netlink.c:1916 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] ____sys_sendmsg+0x5b9/0x910 net/socket.c:2409 ___sys_sendmsg net/socket.c:2463 [inline] __sys_sendmsg+0x280/0x370 net/socket.c:2492 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #5 (genl_mutex){+.+.}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 __mutex_lock_common+0x1d5/0x2590 kernel/locking/mutex.c:607 __mutex_lock kernel/locking/mutex.c:740 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:792 genl_lock net/netlink/genetlink.c:33 [inline] genl_lock_all net/netlink/genetlink.c:46 [inline] genl_register_family+0x455/0x1340 net/netlink/genetlink.c:393 vdpa_init+0x35/0x70 drivers/vdpa/vdpa.c:925 do_one_initcall+0xbd/0x2b0 init/main.c:1295 do_initcall_level+0x14a/0x1f5 init/main.c:1368 do_initcalls+0x4b/0x8c init/main.c:1384 kernel_init_freeable+0x43a/0x5c6 init/main.c:1608 kernel_init+0x19/0x2b0 init/main.c:1497 ret_from_fork+0x1f/0x30 -> #4 (cb_lock){++++}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 down_read+0x39/0x50 kernel/locking/rwsem.c:1474 genl_rcv+0x15/0x40 net/netlink/genetlink.c:802 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x814/0x9f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0xa20/0xe40 net/netlink/af_netlink.c:1916 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg net/socket.c:724 [inline] kernel_sendmsg+0xf5/0x130 net/socket.c:744 sock_no_sendpage+0x153/0x1c0 net/core/sock.c:3080 kernel_sendpage+0x2ca/0x370 net/socket.c:3504 sock_sendpage+0x7e/0xb0 net/socket.c:1003 pipe_to_sendpage+0x258/0x340 fs/splice.c:364 splice_from_pipe_feed fs/splice.c:418 [inline] __splice_from_pipe+0x351/0x8b0 fs/splice.c:562 splice_from_pipe fs/splice.c:597 [inline] generic_splice_sendpage+0x181/0x210 fs/splice.c:746 do_splice_from fs/splice.c:767 [inline] do_splice+0xec9/0x1810 fs/splice.c:1079 __do_splice fs/splice.c:1144 [inline] __do_sys_splice fs/splice.c:1350 [inline] __se_sys_splice+0x2a8/0x410 fs/splice.c:1332 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #3 (&pipe->mutex/1){+.+.}-{3:3}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 __mutex_lock_common+0x1d5/0x2590 kernel/locking/mutex.c:607 __mutex_lock kernel/locking/mutex.c:740 [inline] mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:792 iter_file_splice_write+0x26f/0xfa0 fs/splice.c:635 do_splice_from fs/splice.c:767 [inline] do_splice+0xec9/0x1810 fs/splice.c:1079 __do_splice fs/splice.c:1144 [inline] __do_sys_splice fs/splice.c:1350 [inline] __se_sys_splice+0x2a8/0x410 fs/splice.c:1332 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #2 (sb_writers#3){.+.+}-{0:0}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 percpu_down_read include/linux/percpu-rwsem.h:51 [inline] __sb_start_write include/linux/fs.h:1810 [inline] sb_start_write include/linux/fs.h:1880 [inline] file_start_write include/linux/fs.h:3009 [inline] lo_write_bvec drivers/block/loop.c:242 [inline] lo_write_simple drivers/block/loop.c:265 [inline] do_req_filebacked drivers/block/loop.c:494 [inline] loop_handle_cmd drivers/block/loop.c:1857 [inline] loop_process_work+0x1682/0x22d0 drivers/block/loop.c:1897 process_one_work+0x853/0x1140 kernel/workqueue.c:2298 worker_thread+0xac1/0x1320 kernel/workqueue.c:2445 kthread+0x468/0x490 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 -> #1 ((work_completion)(&lo->rootcg_work)){+.+.}-{0:0}: lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 process_one_work+0x827/0x1140 kernel/workqueue.c:2274 worker_thread+0xac1/0x1320 kernel/workqueue.c:2445 kthread+0x468/0x490 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 -> #0 ((wq_completion)loop3){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3066 [inline] check_prevs_add kernel/locking/lockdep.c:3189 [inline] validate_chain+0x1dfb/0x8240 kernel/locking/lockdep.c:3804 __lock_acquire+0x1382/0x2b00 kernel/locking/lockdep.c:5030 lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 flush_workqueue+0x18e/0x16b0 kernel/workqueue.c:2818 drain_workqueue+0xc3/0x3a0 kernel/workqueue.c:2983 destroy_workqueue+0x7d/0xed0 kernel/workqueue.c:4420 __loop_clr_fd+0x1ec/0x9b0 drivers/block/loop.c:1124 blkdev_put_whole block/bdev.c:694 [inline] blkdev_put+0x477/0x7b0 block/bdev.c:956 deactivate_locked_super+0xa7/0xf0 fs/super.c:335 cleanup_mnt+0x462/0x510 fs/namespace.c:1137 task_work_run+0x146/0x1c0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x209/0x220 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:300 do_syscall_64+0x53/0xd0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: (wq_completion)loop3 --> &disk->open_mutex --> &lo->lo_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&lo->lo_mutex); lock(&disk->open_mutex); lock(&lo->lo_mutex); lock((wq_completion)loop3); *** DEADLOCK *** 2 locks held by syz-executor.3/8571: #0: ffff88801acf6118 (&disk->open_mutex){+.+.}-{3:3}, at: blkdev_put+0xfa/0x7b0 block/bdev.c:914 #1: ffff88801acf1b60 (&lo->lo_mutex){+.+.}-{3:3}, at: __loop_clr_fd+0x6d/0x9b0 drivers/block/loop.c:1106 stack backtrace: CPU: 0 PID: 8571 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106 check_noncircular+0x2f9/0x3b0 kernel/locking/lockdep.c:2146 check_prev_add kernel/locking/lockdep.c:3066 [inline] check_prevs_add kernel/locking/lockdep.c:3189 [inline] validate_chain+0x1dfb/0x8240 kernel/locking/lockdep.c:3804 __lock_acquire+0x1382/0x2b00 kernel/locking/lockdep.c:5030 lock_acquire+0x19f/0x4d0 kernel/locking/lockdep.c:5640 flush_workqueue+0x18e/0x16b0 kernel/workqueue.c:2818 drain_workqueue+0xc3/0x3a0 kernel/workqueue.c:2983 destroy_workqueue+0x7d/0xed0 kernel/workqueue.c:4420 __loop_clr_fd+0x1ec/0x9b0 drivers/block/loop.c:1124 blkdev_put_whole block/bdev.c:694 [inline] blkdev_put+0x477/0x7b0 block/bdev.c:956 deactivate_locked_super+0xa7/0xf0 fs/super.c:335 cleanup_mnt+0x462/0x510 fs/namespace.c:1137 task_work_run+0x146/0x1c0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x209/0x220 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:300 do_syscall_64+0x53/0xd0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f6a4e62cf57 Code: ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcfbb170a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f6a4e62cf57 RDX: 00007ffcfbb1717b RSI: 000000000000000a RDI: 00007ffcfbb17170 RBP: 00007ffcfbb17170 R08: 00000000ffffffff R09: 00007ffcfbb16f40 R10: 00005555566fd903 R11: 0000000000000246 R12: 00007f6a4e6850dd R13: 00007ffcfbb18230 R14: 00005555566fd810 R15: 00007ffcfbb18270