====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G U ------------------------------------------------------ udevd/19432 is trying to acquire lock: ffff888032ba9470 (&nsock->tx_lock){+.+.}-{4:4}, at: nbd_handle_cmd drivers/block/nbd.c:1140 [inline] ffff888032ba9470 (&nsock->tx_lock){+.+.}-{4:4}, at: nbd_queue_rq+0x423/0x12d0 drivers/block/nbd.c:1204 but task is already holding lock: ffff888025dbe178 (&cmd->lock){+.+.}-{4:4}, at: nbd_queue_rq+0xbd/0x12d0 drivers/block/nbd.c:1196 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&cmd->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 nbd_queue_rq+0xbd/0x12d0 drivers/block/nbd.c:1196 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2129 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcb7/0x15f0 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd8/0x1b0 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x239/0x670 block/blk-mq.c:2367 blk_mq_dispatch_list+0x514/0x1310 block/blk-mq.c:2928 blk_mq_flush_plug_list block/blk-mq.c:2976 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2948 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] blk_finish_plug block/blk-core.c:1249 [inline] __submit_bio+0x545/0x690 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x53d/0xc10 block/blk-core.c:755 submit_bio_noacct+0xbbb/0x1f60 block/blk-core.c:879 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x4db/0x850 fs/buffer.c:2461 filemap_read_folio+0xc8/0x2a0 mm/filemap.c:2444 do_read_cache_folio+0x263/0x5c0 mm/filemap.c:4024 read_mapping_folio include/linux/pagemap.h:999 [inline] read_part_sector+0xd4/0x370 block/partitions/core.c:722 adfspart_check_ICS+0x93/0x940 block/partitions/acorn.c:360 check_partition block/partitions/core.c:141 [inline] blk_add_partitions block/partitions/core.c:589 [inline] bdev_disk_changed+0x723/0x1520 block/partitions/core.c:693 blkdev_get_whole+0x187/0x290 block/bdev.c:748 bdev_open+0x2c7/0xe40 block/bdev.c:957 blkdev_open+0x34e/0x4f0 block/fops.c:694 do_dentry_open+0x97f/0x1530 fs/open.c:965 vfs_open+0x82/0x3f0 fs/open.c:1097 do_open fs/namei.c:3975 [inline] path_openat+0x1de4/0x2cb0 fs/namei.c:4134 do_filp_open+0x20b/0x470 fs/namei.c:4161 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (set->srcu){.+.+}-{0:0}: srcu_lock_sync include/linux/srcu.h:173 [inline] __synchronize_srcu+0xa1/0x290 kernel/rcu/srcutree.c:1429 blk_mq_wait_quiesce_done block/blk-mq.c:283 [inline] blk_mq_wait_quiesce_done block/blk-mq.c:280 [inline] blk_mq_quiesce_queue block/blk-mq.c:303 [inline] blk_mq_quiesce_queue+0x149/0x1b0 block/blk-mq.c:298 queue_wb_lat_store+0x269/0x3d0 block/blk-sysfs.c:684 queue_attr_store+0x26b/0x310 block/blk-sysfs.c:869 sysfs_kf_write+0xef/0x150 fs/sysfs/file.c:142 kernfs_fop_write_iter+0x3ac/0x570 fs/kernfs/file.c:352 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d0/0x11d0 fs/read_write.c:686 ksys_write+0x12a/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&q->q_usage_counter(io)#69){++++}-{0:0}: blk_alloc_queue+0x619/0x760 block/blk-core.c:461 blk_mq_alloc_queue+0x172/0x280 block/blk-mq.c:4399 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4446 add_mtd_blktrans_dev+0x7ad/0x15a0 drivers/mtd/mtd_blkdevs.c:343 mtdblock_add_mtd+0x1cc/0x270 drivers/mtd/mtdblock.c:333 blktrans_notify_add drivers/mtd/mtd_blkdevs.c:464 [inline] blktrans_notify_add+0x9f/0xf0 drivers/mtd/mtd_blkdevs.c:456 add_mtd_device+0xb07/0x1720 drivers/mtd/mtdcore.c:770 mtd_device_parse_register+0x7c2/0xb10 drivers/mtd/mtdcore.c:1083 mtdram_init_device+0x298/0x350 drivers/mtd/devices/mtdram.c:146 init_mtdram+0xba/0x1b0 drivers/mtd/devices/mtdram.c:171 do_one_initcall+0x120/0x6e0 init/main.c:1283 do_initcall_level init/main.c:1345 [inline] do_initcalls init/main.c:1361 [inline] do_basic_setup init/main.c:1380 [inline] kernel_init_freeable+0x5c2/0x910 init/main.c:1593 kernel_init+0x1c/0x2b0 init/main.c:1483 ret_from_fork+0x56d/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4269 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4283 might_alloc include/linux/sched/mm.h:318 [inline] slab_pre_alloc_hook mm/slub.c:4897 [inline] slab_alloc_node mm/slub.c:5221 [inline] kmem_cache_alloc_node_noprof+0x5e/0x770 mm/slub.c:5297 __alloc_skb+0x2b2/0x380 net/core/skbuff.c:660 alloc_skb_fclone include/linux/skbuff.h:1433 [inline] tcp_stream_alloc_skb+0x34/0x560 net/ipv4/tcp.c:912 tcp_sendmsg_locked+0x12d9/0x42e0 net/ipv4/tcp.c:1218 tcp_sendmsg+0x2e/0x50 net/ipv4/tcp.c:1413 inet_sendmsg+0xb9/0x140 net/ipv4/af_inet.c:853 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] sock_write_iter+0x509/0x610 net/socket.c:1195 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7d0/0x11d0 fs/read_write.c:686 ksys_write+0x1f8/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (sk_lock-AF_INET){+.+.}-{0:0}: lock_sock_nested+0x41/0xf0 net/core/sock.c:3720 lock_sock include/net/sock.h:1679 [inline] inet_shutdown+0x67/0x440 net/ipv4/af_inet.c:907 nbd_mark_nsock_dead+0xae/0x5d0 drivers/block/nbd.c:318 recv_work+0x671/0xa80 drivers/block/nbd.c:1018 process_one_work+0x9cc/0x1b70 kernel/workqueue.c:3263 process_scheduled_works kernel/workqueue.c:3346 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3427 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x56d/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #0 (&nsock->tx_lock){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 nbd_handle_cmd drivers/block/nbd.c:1140 [inline] nbd_queue_rq+0x423/0x12d0 drivers/block/nbd.c:1204 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2129 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcb7/0x15f0 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd8/0x1b0 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x239/0x670 block/blk-mq.c:2367 blk_mq_dispatch_list+0x514/0x1310 block/blk-mq.c:2928 blk_mq_flush_plug_list block/blk-mq.c:2976 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2948 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] blk_finish_plug block/blk-core.c:1249 [inline] __submit_bio+0x545/0x690 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x53d/0xc10 block/blk-core.c:755 submit_bio_noacct+0xbbb/0x1f60 block/blk-core.c:879 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x4db/0x850 fs/buffer.c:2461 filemap_read_folio+0xc8/0x2a0 mm/filemap.c:2444 do_read_cache_folio+0x263/0x5c0 mm/filemap.c:4024 read_mapping_folio include/linux/pagemap.h:999 [inline] read_part_sector+0xd4/0x370 block/partitions/core.c:722 adfspart_check_ICS+0x93/0x940 block/partitions/acorn.c:360 check_partition block/partitions/core.c:141 [inline] blk_add_partitions block/partitions/core.c:589 [inline] bdev_disk_changed+0x723/0x1520 block/partitions/core.c:693 blkdev_get_whole+0x187/0x290 block/bdev.c:748 bdev_open+0x2c7/0xe40 block/bdev.c:957 blkdev_open+0x34e/0x4f0 block/fops.c:694 do_dentry_open+0x97f/0x1530 fs/open.c:965 vfs_open+0x82/0x3f0 fs/open.c:1097 do_open fs/namei.c:3975 [inline] path_openat+0x1de4/0x2cb0 fs/namei.c:4134 do_filp_open+0x20b/0x470 fs/namei.c:4161 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &nsock->tx_lock --> set->srcu --> &cmd->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&cmd->lock); lock(set->srcu); lock(&cmd->lock); lock(&nsock->tx_lock); *** DEADLOCK *** 3 locks held by udevd/19432: #0: ffff888025cdc358 (&disk->open_mutex){+.+.}-{4:4}, at: bdev_open+0x41a/0xe40 block/bdev.c:945 #1: ffff88802557a290 (set->srcu){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:161 [inline] #1: ffff88802557a290 (set->srcu){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:253 [inline] #1: ffff88802557a290 (set->srcu){.+.+}-{0:0}, at: blk_mq_run_hw_queue+0x22b/0x670 block/blk-mq.c:2367 #2: ffff888025dbe178 (&cmd->lock){+.+.}-{4:4}, at: nbd_queue_rq+0xbd/0x12d0 drivers/block/nbd.c:1196 stack backtrace: CPU: 0 UID: 0 PID: 19432 Comm: udevd Tainted: G U syzkaller #0 PREEMPT(full) Tainted: [U]=USER Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 nbd_handle_cmd drivers/block/nbd.c:1140 [inline] nbd_queue_rq+0x423/0x12d0 drivers/block/nbd.c:1204 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2129 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcb7/0x15f0 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd8/0x1b0 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x239/0x670 block/blk-mq.c:2367 blk_mq_dispatch_list+0x514/0x1310 block/blk-mq.c:2928 blk_mq_flush_plug_list block/blk-mq.c:2976 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2948 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] blk_finish_plug block/blk-core.c:1249 [inline] __submit_bio+0x545/0x690 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x53d/0xc10 block/blk-core.c:755 submit_bio_noacct+0xbbb/0x1f60 block/blk-core.c:879 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x4db/0x850 fs/buffer.c:2461 filemap_read_folio+0xc8/0x2a0 mm/filemap.c:2444 do_read_cache_folio+0x263/0x5c0 mm/filemap.c:4024 read_mapping_folio include/linux/pagemap.h:999 [inline] read_part_sector+0xd4/0x370 block/partitions/core.c:722 adfspart_check_ICS+0x93/0x940 block/partitions/acorn.c:360 check_partition block/partitions/core.c:141 [inline] blk_add_partitions block/partitions/core.c:589 [inline] bdev_disk_changed+0x723/0x1520 block/partitions/core.c:693 blkdev_get_whole+0x187/0x290 block/bdev.c:748 bdev_open+0x2c7/0xe40 block/bdev.c:957 blkdev_open+0x34e/0x4f0 block/fops.c:694 do_dentry_open+0x97f/0x1530 fs/open.c:965 vfs_open+0x82/0x3f0 fs/open.c:1097 do_open fs/namei.c:3975 [inline] path_openat+0x1de4/0x2cb0 fs/namei.c:4134 do_filp_open+0x20b/0x470 fs/namei.c:4161 do_sys_openat2+0x11b/0x1d0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fdb90ca7407 Code: 48 89 fa 4c 89 df e8 38 aa 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff RSP: 002b:00007fffab208200 EFLAGS: 00000202 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007fdb913bc880 RCX: 00007fdb90ca7407 RDX: 00000000000a0800 RSI: 000055911fde62d0 RDI: ffffffffffffff9c RBP: 000055911fde5910 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 000055911ff49700 R13: 000055911fe04930 R14: 0000000000000000 R15: 000055911ff49700 block nbd0: Dead connection, failed to find a fallback block nbd0: shutting down sockets I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read ldm_validate_partition_table(): Disk read failed. I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read I/O error, dev nbd0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2 Buffer I/O error on dev nbd0, logical block 0, async page read Dev nbd0: unable to read RDB block 0 nbd0: unable to read partition table ldm_validate_partition_table(): Disk read failed. Dev nbd0: unable to read RDB block 0 nbd0: unable to read partition table