block nbd1: shutting down sockets ====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/11637 is trying to acquire lock: 00000000c1af3174 ((wq_completion)"knbd%d-recv"nbd->index){+.+.}, at: flush_workqueue+0xe8/0x13e0 kernel/workqueue.c:2658 but task is already holding lock: 0000000014dc318a (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock lib/refcount.c:311 [inline] 0000000014dc318a (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock+0x4a/0x80 lib/refcount.c:306 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #8 (&nbd->config_lock){+.+.}: nbd_open+0x2e2/0x6f0 drivers/block/nbd.c:1428 __blkdev_get+0x372/0x1480 fs/block_dev.c:1494 blkdev_get+0xb0/0x940 fs/block_dev.c:1627 blkdev_open+0x202/0x290 fs/block_dev.c:1788 do_dentry_open+0x4aa/0x1160 fs/open.c:796 do_last fs/namei.c:3421 [inline] path_openat+0x793/0x2df0 fs/namei.c:3537 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #7 (nbd_index_mutex){+.+.}: nbd_open+0x73/0x6f0 drivers/block/nbd.c:1415 __blkdev_get+0x372/0x1480 fs/block_dev.c:1494 blkdev_get+0xb0/0x940 fs/block_dev.c:1627 blkdev_open+0x202/0x290 fs/block_dev.c:1788 do_dentry_open+0x4aa/0x1160 fs/open.c:796 do_last fs/namei.c:3421 [inline] path_openat+0x793/0x2df0 fs/namei.c:3537 do_filp_open+0x18c/0x3f0 fs/namei.c:3567 do_sys_open+0x3b3/0x520 fs/open.c:1085 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #6 (&bdev->bd_mutex){+.+.}: blkdev_put+0x30/0x520 fs/block_dev.c:1839 btrfs_close_bdev fs/btrfs/volumes.c:1033 [inline] btrfs_close_one_device fs/btrfs/volumes.c:1057 [inline] close_fs_devices.part.0+0x24d/0x8e0 fs/btrfs/volumes.c:1085 close_fs_devices fs/btrfs/volumes.c:1117 [inline] btrfs_close_devices+0x95/0x1f0 fs/btrfs/volumes.c:1103 close_ctree+0x3c8/0x850 fs/btrfs/disk-io.c:4047 generic_shutdown_super+0x144/0x370 fs/super.c:456 kill_anon_super+0x36/0x60 fs/super.c:1032 btrfs_kill_super+0x49/0x550 fs/btrfs/super.c:2221 deactivate_locked_super+0x94/0x160 fs/super.c:329 deactivate_super+0x174/0x1a0 fs/super.c:360 cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #5 (&fs_devs->device_list_mutex){+.+.}: btrfs_finish_chunk_alloc+0x27b/0xf90 fs/btrfs/volumes.c:4938 btrfs_create_pending_block_groups+0x242/0x590 fs/btrfs/extent-tree.c:10134 __btrfs_end_transaction+0x21a/0xb00 fs/btrfs/transaction.c:855 flush_space+0xa41/0xee0 fs/btrfs/extent-tree.c:4861 btrfs_async_reclaim_metadata_space+0x466/0x1050 fs/btrfs/extent-tree.c:4977 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #4 (sb_internal#2){.+.+}: sb_start_intwrite include/linux/fs.h:1626 [inline] start_transaction+0xa37/0xf90 fs/btrfs/transaction.c:528 btrfs_dirty_inode+0xe3/0x210 fs/btrfs/inode.c:6165 btrfs_update_time+0x33b/0x3d0 fs/btrfs/inode.c:6207 update_time fs/inode.c:1675 [inline] touch_atime+0x23c/0x2a0 fs/inode.c:1746 file_accessed include/linux/fs.h:2123 [inline] btrfs_file_mmap+0x11b/0x160 fs/btrfs/file.c:2274 call_mmap include/linux/fs.h:1826 [inline] mmap_region+0xc94/0x16b0 mm/mmap.c:1757 do_mmap+0x8e8/0x1080 mm/mmap.c:1530 do_mmap_pgoff include/linux/mm.h:2329 [inline] vm_mmap_pgoff+0x197/0x200 mm/util.c:357 ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #3 (&mm->mmap_sem){++++}: _copy_to_iter+0x3d0/0xea0 lib/iov_iter.c:564 copy_to_iter include/linux/uio.h:106 [inline] skb_copy_datagram_iter+0x469/0x9e0 net/core/datagram.c:431 skb_copy_datagram_msg include/linux/skbuff.h:3347 [inline] unix_dgram_recvmsg+0x3b7/0xdb0 net/unix/af_unix.c:2180 sock_recvmsg_nosec net/socket.c:859 [inline] sock_recvmsg net/socket.c:866 [inline] sock_recvmsg net/socket.c:862 [inline] __sys_recvfrom+0x249/0x3a0 net/socket.c:1956 __do_sys_recvfrom net/socket.c:1974 [inline] __se_sys_recvfrom net/socket.c:1970 [inline] __x64_sys_recvfrom+0xdd/0x1b0 net/socket.c:1970 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #2 (&u->iolock){+.+.}: unix_stream_read_generic+0x2de/0x1a40 net/unix/af_unix.c:2322 unix_stream_recvmsg+0xb1/0xf0 net/unix/af_unix.c:2505 sock_recvmsg_nosec net/socket.c:859 [inline] sock_recvmsg net/socket.c:866 [inline] sock_recvmsg+0xca/0x110 net/socket.c:862 sock_xmit+0x37d/0x5c0 drivers/block/nbd.c:439 nbd_read_stat drivers/block/nbd.c:633 [inline] recv_work+0x1e9/0x1100 drivers/block/nbd.c:732 process_one_work+0x864/0x1570 kernel/workqueue.c:2153 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #1 ((work_completion)(&args->work)){+.+.}: worker_thread+0x64c/0x1130 kernel/workqueue.c:2296 kthread+0x33f/0x460 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 -> #0 ((wq_completion)"knbd%d-recv"nbd->index){+.+.}: flush_workqueue+0x117/0x13e0 kernel/workqueue.c:2661 drain_workqueue+0x1a5/0x460 kernel/workqueue.c:2826 destroy_workqueue+0x75/0x790 kernel/workqueue.c:4183 nbd_config_put+0x3c5/0x870 drivers/block/nbd.c:1175 nbd_release+0xf4/0x170 drivers/block/nbd.c:1461 __blkdev_put+0x636/0x870 fs/block_dev.c:1819 blkdev_close+0x86/0xb0 fs/block_dev.c:1888 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: (wq_completion)"knbd%d-recv"nbd->index --> nbd_index_mutex --> &nbd->config_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&nbd->config_lock); lock(nbd_index_mutex); lock(&nbd->config_lock); lock((wq_completion)"knbd%d-recv"nbd->index); *** DEADLOCK *** 2 locks held by syz-executor.1/11637: #0: 00000000227bb43c (&bdev->bd_mutex){+.+.}, at: __blkdev_put+0xfc/0x870 fs/block_dev.c:1806 #1: 0000000014dc318a (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock lib/refcount.c:311 [inline] #1: 0000000014dc318a (&nbd->config_lock){+.+.}, at: refcount_dec_and_mutex_lock+0x4a/0x80 lib/refcount.c:306 stack backtrace: CPU: 0 PID: 11637 Comm: syz-executor.1 Not tainted 4.19.211-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1fc/0x2ef lib/dump_stack.c:118 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222 check_prev_add kernel/locking/lockdep.c:1866 [inline] check_prevs_add kernel/locking/lockdep.c:1979 [inline] validate_chain kernel/locking/lockdep.c:2420 [inline] __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908 flush_workqueue+0x117/0x13e0 kernel/workqueue.c:2661 drain_workqueue+0x1a5/0x460 kernel/workqueue.c:2826 destroy_workqueue+0x75/0x790 kernel/workqueue.c:4183 nbd_config_put+0x3c5/0x870 drivers/block/nbd.c:1175 nbd_release+0xf4/0x170 drivers/block/nbd.c:1461 __blkdev_put+0x636/0x870 fs/block_dev.c:1819 blkdev_close+0x86/0xb0 fs/block_dev.c:1888 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fc1dd732f8b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007fffba7818b0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000008 RCX: 00007fc1dd732f8b RDX: 0000000000000000 RSI: 0000001b2ed25338 RDI: 0000000000000007 RBP: 00007fc1dd8a2980 R08: 0000000000000000 R09: 00000000ee5a3a10 R10: 0000000000000000 R11: 0000000000000293 R12: 000000000005beac R13: 00007fffba7819b0 R14: 00007fffba7819d0 R15: 0000000000000032 block nbd1: shutting down sockets wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50 block nbd1: Device being setup by another task block nbd1: shutting down sockets kauditd_printk_skb: 59 callbacks suppressed audit: type=1804 audit(1670137306.644:99): pid=11735 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/35/file0/bus" dev="ramfs" ino=35991 res=1 audit: type=1804 audit(1670137306.694:100): pid=11735 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/35/file0/bus" dev="ramfs" ino=35991 res=1 audit: type=1804 audit(1670137306.744:101): pid=11735 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/35/file0/bus" dev="ramfs" ino=35991 res=1 audit: type=1804 audit(1670137307.194:102): pid=11756 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/36/file0/bus" dev="ramfs" ino=37184 res=1 audit: type=1804 audit(1670137307.244:103): pid=11756 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/36/file0/bus" dev="ramfs" ino=37184 res=1 audit: type=1804 audit(1670137307.284:104): pid=11756 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/36/file0/bus" dev="ramfs" ino=37184 res=1 audit: type=1804 audit(1670137307.524:105): pid=11756 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/36/file0/file0/bus" dev="ramfs" ino=37340 res=1 audit: type=1804 audit(1670137307.564:106): pid=11756 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/36/file0/file0/bus" dev="ramfs" ino=37340 res=1 audit: type=1804 audit(1670137307.584:107): pid=11756 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/36/file0/bus" dev="ramfs" ino=37184 res=1 wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50 audit: type=1804 audit(1670137308.044:108): pid=11820 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1605946067/syzkaller.l4gbpy/37/file0/bus" dev="ramfs" ino=36357 res=1 IPVS: ftp: loaded support on port[0] = 21 nf_conntrack: default automatic helper assignment has been turned off for security reasons and CT-based firewall rule not found. Use the iptables CT target to attach helpers instead. overlayfs: fs on './file0' does not support file handles, falling back to index=off,nfs_export=off. IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 netlink: 164 bytes leftover after parsing attributes in process `syz-executor.1'. ieee802154 phy0 wpan0: encryption failed: -22 ieee802154 phy1 wpan1: encryption failed: -22 netlink: 164 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 164 bytes leftover after parsing attributes in process `syz-executor.1'. netlink: 164 bytes leftover after parsing attributes in process `syz-executor.1'. wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50 RDS: rds_bind could not find a transport for ::ffff:172.20.20.0, load rds_tcp or rds_rdma? RDS: rds_bind could not find a transport for ::ffff:172.20.20.0, load rds_tcp or rds_rdma? RDS: rds_bind could not find a transport for ::ffff:172.20.20.0, load rds_tcp or rds_rdma?