====================================================== WARNING: possible circular locking dependency detected 5.13.0-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor385/8453 is trying to acquire lock: ffff88801f052d18 (&disk->open_mutex){+.+.}-{3:3}, at: del_gendisk+0x8b/0x770 block/genhd.c:587 but task is already holding lock: ffffffff8cc7cb68 (nbd_index_mutex){+.+.}-{3:3}, at: refcount_dec_and_mutex_lock lib/refcount.c:118 [inline] ffffffff8cc7cb68 (nbd_index_mutex){+.+.}-{3:3}, at: refcount_dec_and_mutex_lock+0x50/0x140 lib/refcount.c:113 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (nbd_index_mutex){+.+.}-{3:3}: __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x12a/0x10a0 kernel/locking/mutex.c:1104 nbd_open+0x7d/0x8a0 drivers/block/nbd.c:1456 blkdev_get_whole+0xa1/0x420 fs/block_dev.c:1251 blkdev_get_by_dev.part.0+0x30c/0xdd0 fs/block_dev.c:1415 blkdev_get_by_dev fs/block_dev.c:1504 [inline] blkdev_open+0x295/0x300 fs/block_dev.c:1510 do_dentry_open+0x4c8/0x11c0 fs/open.c:826 do_open fs/namei.c:3361 [inline] path_openat+0x1c0e/0x27e0 fs/namei.c:3494 do_filp_open+0x190/0x3d0 fs/namei.c:3521 do_sys_openat2+0x16d/0x420 fs/open.c:1195 do_sys_open fs/open.c:1211 [inline] __do_sys_open fs/open.c:1219 [inline] __se_sys_open fs/open.c:1215 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1215 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> #0 (&disk->open_mutex){+.+.}-{3:3}: check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x2a07/0x54a0 kernel/locking/lockdep.c:5015 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x12a/0x10a0 kernel/locking/mutex.c:1104 del_gendisk+0x8b/0x770 block/genhd.c:587 nbd_dev_remove drivers/block/nbd.c:224 [inline] nbd_put.part.0+0x82/0x160 drivers/block/nbd.c:246 nbd_put drivers/block/nbd.c:1903 [inline] nbd_genl_connect+0x1214/0x1660 drivers/block/nbd.c:1957 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x85b/0xda0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:702 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:722 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2385 ___sys_sendmsg+0xf3/0x170 net/socket.c:2439 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2468 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(nbd_index_mutex); lock(&disk->open_mutex); lock(nbd_index_mutex); lock(&disk->open_mutex); *** DEADLOCK *** 3 locks held by syz-executor385/8453: #0: ffffffff8d94a490 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:810 #1: ffffffff8d94a548 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline] #1: ffffffff8d94a548 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x3e0/0x580 net/netlink/genetlink.c:798 #2: ffffffff8cc7cb68 (nbd_index_mutex){+.+.}-{3:3}, at: refcount_dec_and_mutex_lock lib/refcount.c:118 [inline] #2: ffffffff8cc7cb68 (nbd_index_mutex){+.+.}-{3:3}, at: refcount_dec_and_mutex_lock+0x50/0x140 lib/refcount.c:113 stack backtrace: CPU: 0 PID: 8453 Comm: syz-executor385 Not tainted 5.13.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:79 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:96 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2131 check_prev_add kernel/locking/lockdep.c:3051 [inline] check_prevs_add kernel/locking/lockdep.c:3174 [inline] validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x2a07/0x54a0 kernel/locking/lockdep.c:5015 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __mutex_lock_common kernel/locking/mutex.c:959 [inline] __mutex_lock+0x12a/0x10a0 kernel/locking/mutex.c:1104 del_gendisk+0x8b/0x770 block/genhd.c:587 nbd_dev_remove drivers/block/nbd.c:224 [inline] nbd_put.part.0+0x82/0x160 drivers/block/nbd.c:246 nbd_put drivers/block/nbd.c:1903 [inline] nbd_genl_connect+0x1214/0x1660 drivers/block/nbd.c:1957 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x85b/0xda0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:702 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:722 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2385 ___sys_sendmsg+0xf3/0x170 net/socket.c:2439 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2468 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x43fa89 Code: 28 c3 e8 5a 14 00 00 66 2e 0f 1f 84 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fffa3b11d18 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 000000000043fa89 RDX: 0000000000000000 RSI: 0000000020001880 RDI: 0000000000000004 RBP: 00000000004034f0 R08: 0000000000000004 R09: 00000000004004a0 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000403580 R13: 0000000000000000 R14: 00000000004ad018 R15: 00000000004004a0 general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 1 PID: 8453 Comm: syz-executor385 Not tainted 5.13.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:blk_mq_map_queue_type block/blk-mq.h:96 [inline] RIP: 0010:blk_mq_get_sq_hctx block/blk-mq.c:1663 [inline] RIP: 0010:blk_mq_run_hw_queues+0x32b/0x4a0 block/blk-mq.c:1682 Code: ea 48 c1 ea 03 80 3c 02 00 0f 85 51 01 00 00 48 8b 45 00 89 db 48 8d 1c 98 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <0f> b6 14 02 48 89 d8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 ed RSP: 0018:ffffc9000169f3b0 EFLAGS: 00010247 RAX: dffffc0000000000 RBX: 0000000000000004 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff83be8009 RDI: ffff8881460cb4c0 RBP: ffff88801f426000 R08: 0000000000000000 R09: ffff8881460cb437 R10: ffffffff83be7e41 R11: 0000000000000000 R12: ffff8881460caaf0 R13: ffff8881460d5f00 R14: ffff8880168c3808 R15: 0000000000000001 FS: 00000000008a3300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00005564442c0928 CR3: 0000000036ecc000 CR4: 00000000001506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: blk_freeze_queue_start+0xc4/0xe0 block/blk-mq.c:142 blk_set_queue_dying+0x24/0x80 block/blk-core.c:353 blk_cleanup_queue+0x7b/0x1e0 block/blk-core.c:380 blk_cleanup_disk+0x33/0x80 block/genhd.c:1324 nbd_dev_remove drivers/block/nbd.c:226 [inline] nbd_put.part.0+0x92/0x160 drivers/block/nbd.c:246 nbd_put drivers/block/nbd.c:1903 [inline] nbd_genl_connect+0x1214/0x1660 drivers/block/nbd.c:1957 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739 genl_family_rcv_msg net/netlink/genetlink.c:783 [inline] genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504 genl_rcv+0x24/0x40 net/netlink/genetlink.c:811 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340 netlink_sendmsg+0x85b/0xda0 net/netlink/af_netlink.c:1929 sock_sendmsg_nosec net/socket.c:702 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:722 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2385 ___sys_sendmsg+0xf3/0x170 net/socket.c:2439 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2468 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x43fa89 Code: 28 c3 e8 5a 14 00 00 66 2e 0f 1f 84 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fffa3b11d18 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 000000000043fa89 RDX: 0000000000000000 RSI: 0000000020001880 RDI: 0000000000000004 RBP: 00000000004034f0 R08: 0000000000000004 R09: 00000000004004a0 R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000403580 R13: 0000000000000000 R14: 00000000004ad018 R15: 00000000004004a0 Modules linked in: ---[ end trace 5901d46f06584e8e ]--- RIP: 0010:blk_mq_map_queue_type block/blk-mq.h:96 [inline] RIP: 0010:blk_mq_get_sq_hctx block/blk-mq.c:1663 [inline] RIP: 0010:blk_mq_run_hw_queues+0x32b/0x4a0 block/blk-mq.c:1682 Code: ea 48 c1 ea 03 80 3c 02 00 0f 85 51 01 00 00 48 8b 45 00 89 db 48 8d 1c 98 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <0f> b6 14 02 48 89 d8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 ed RSP: 0018:ffffc9000169f3b0 EFLAGS: 00010247 RAX: dffffc0000000000 RBX: 0000000000000004 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff83be8009 RDI: ffff8881460cb4c0 RBP: ffff88801f426000 R08: 0000000000000000 R09: ffff8881460cb437 R10: ffffffff83be7e41 R11: 0000000000000000 R12: ffff8881460caaf0 R13: ffff8881460d5f00 R14: ffff8880168c3808 R15: 0000000000000001 FS: 00000000008a3300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ff95803e0a8 CR3: 0000000036ecc000 CR4: 00000000001506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400