usb 3-1: USB disconnect, device number 21 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ kworker/0:3/5689 is trying to acquire lock: ffff88801c284aa0 (&root->kernfs_supers_rwsem){++++}-{4:4}, at: kernfs_remove+0x35/0x80 fs/kernfs/dir.c:1621 but task is already holding lock: ffffffff8fc1e680 (gdp_mutex){+.+.}-{4:4}, at: cleanup_glue_dir+0xc3/0x220 drivers/base/core.c:3435 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #10 (gdp_mutex){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 get_device_parent+0x16f/0x3a0 drivers/base/core.c:3338 device_add+0x2d4/0xb80 drivers/base/core.c:3685 device_create_groups_vargs drivers/base/core.c:4458 [inline] device_create+0x269/0x300 drivers/base/core.c:4497 msr_device_create+0x33/0x50 arch/x86/kernel/msr.c:254 cpuhp_invoke_callback+0x434/0x810 kernel/cpu.c:194 cpuhp_thread_fun+0x362/0x780 kernel/cpu.c:1109 smpboot_thread_fn+0x565/0xa70 kernel/smpboot.c:160 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #9 (cpuhp_state-up){+.+.}-{0:0}: cpuhp_lock_acquire kernel/cpu.c:103 [inline] cpuhp_thread_fun+0x127/0x780 kernel/cpu.c:1086 smpboot_thread_fn+0x565/0xa70 kernel/smpboot.c:160 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #8 (cpu_hotplug_lock){++++}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read include/linux/percpu-rwsem.h:77 [inline] cpus_read_lock+0x3d/0x160 kernel/cpu.c:490 static_key_slow_inc+0x12/0x30 kernel/jump_label.c:190 nbd_genl_reconnect_sock_cb+0x69a/0xbb0 drivers/block/nbd.c:1377 nbd_genl_foreach_sock+0x265/0x450 drivers/block/nbd.c:2152 nbd_genl_reconfigure+0xbbb/0x1040 drivers/block/nbd.c:2477 genl_family_rcv_msg_doit+0x233/0x340 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x614/0x7a0 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x226/0x4a0 net/netlink/af_netlink.c:2572 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1335 [inline] netlink_unicast+0x7bd/0x940 net/netlink/af_netlink.c:1361 netlink_sendmsg+0x7c3/0xae0 net/netlink/af_netlink.c:1916 sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800 __sock_sendmsg net/socket.c:815 [inline] ____sys_sendmsg+0x54e/0x850 net/socket.c:2712 ___sys_sendmsg+0x2a5/0x360 net/socket.c:2766 __sys_sendmsg net/socket.c:2798 [inline] __do_sys_sendmsg net/socket.c:2803 [inline] __se_sys_sendmsg net/socket.c:2801 [inline] __x64_sys_sendmsg+0x1b1/0x290 net/socket.c:2801 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #7 (&nsock->tx_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 nbd_handle_cmd drivers/block/nbd.c:1143 [inline] nbd_queue_rq+0x373/0xff0 drivers/block/nbd.c:1207 blk_mq_dispatch_rq_list+0x499/0x1990 block/blk-mq.c:2130 __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+0xd36/0x1580 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x167/0x2f0 block/blk-mq.c:2545 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #6 (&cmd->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 nbd_queue_rq+0xc1/0xff0 drivers/block/nbd.c:1199 blk_mq_dispatch_rq_list+0x499/0x1990 block/blk-mq.c:2130 __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+0xd36/0x1580 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x167/0x2f0 block/blk-mq.c:2545 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #5 (set->srcu){.+.+}-{0:0}: srcu_lock_sync include/linux/srcu.h:225 [inline] __synchronize_srcu+0xca/0x2f0 kernel/rcu/srcutree.c:1660 elevator_switch+0x1e8/0x7b0 block/elevator.c:576 elevator_change+0x2fa/0x480 block/elevator.c:681 elevator_set_default+0x375/0x440 block/elevator.c:754 blk_register_queue+0x3f3/0x4e0 block/blk-sysfs.c:992 __add_disk+0x6b8/0xdb0 block/genhd.c:531 add_disk_fwnode+0x100/0x3a0 block/genhd.c:600 add_disk include/linux/blkdev.h:801 [inline] nbd_dev_add+0x733/0xb60 drivers/block/nbd.c:2026 nbd_init+0x168/0x1f0 drivers/block/nbd.c:2743 do_one_initcall+0x250/0x870 init/main.c:1360 do_initcall_level+0x10a/0x1a0 init/main.c:1422 do_initcalls+0x59/0xa0 init/main.c:1438 kernel_init_freeable+0x29d/0x3e0 init/main.c:1673 kernel_init+0x22/0x1d0 init/main.c:1563 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #4 (&q->elevator_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 elevator_change+0x1af/0x480 block/elevator.c:679 elv_iosched_store+0x504/0x630 block/elevator.c:826 queue_attr_store+0x207/0x2b0 block/blk-sysfs.c:906 kernfs_fop_write_iter+0x3a4/0x540 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x612/0xba0 fs/read_write.c:687 ksys_write+0x150/0x270 fs/read_write.c:739 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&q->q_usage_counter(io)#66){++++}-{0:0}: blk_alloc_queue+0x544/0x690 block/blk-core.c:504 blk_mq_alloc_queue block/blk-mq.c:4431 [inline] __blk_mq_alloc_disk+0x194/0x390 block/blk-mq.c:4478 null_add_dev+0xe82/0x1d70 drivers/block/null_blk/main.c:2017 null_create_dev drivers/block/null_blk/main.c:2114 [inline] null_init+0x1e3/0x390 drivers/block/null_blk/main.c:2178 do_one_initcall+0x250/0x870 init/main.c:1360 do_initcall_level+0x10a/0x1a0 init/main.c:1422 do_initcalls+0x59/0xa0 init/main.c:1438 kernel_init_freeable+0x29d/0x3e0 init/main.c:1673 kernel_init+0x22/0x1d0 init/main.c:1563 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 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:4365 [inline] fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4379 might_alloc include/linux/sched/mm.h:316 [inline] slab_pre_alloc_hook mm/slub.c:4673 [inline] slab_alloc_node mm/slub.c:5011 [inline] kmem_cache_alloc_lru_noprof+0x65/0x5f0 mm/slub.c:5066 alloc_inode+0xb8/0x1b0 fs/inode.c:341 iget_locked+0x12c/0x690 fs/inode.c:1473 kernfs_get_inode+0x4f/0x770 fs/kernfs/inode.c:250 kernfs_fill_super fs/kernfs/mount.c:318 [inline] kernfs_get_tree+0x5cd/0x980 fs/kernfs/mount.c:402 vfs_get_tree+0x92/0x2a0 fs/super.c:1943 fc_mount fs/namespace.c:1209 [inline] do_new_mount_fc fs/namespace.c:3785 [inline] do_new_mount+0x319/0xdc0 fs/namespace.c:3861 do_mount fs/namespace.c:4194 [inline] __do_sys_mount fs/namespace.c:4407 [inline] __se_sys_mount+0x31d/0x420 fs/namespace.c:4384 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&root->kernfs_rwsem){++++}-{4:4}: down_write+0x91/0x200 kernel/locking/rwsem.c:1631 kernfs_remove_by_name_ns+0x4e/0x140 fs/kernfs/dir.c:1791 sysfs_remove_file include/linux/sysfs.h:780 [inline] device_remove_file drivers/base/core.c:3146 [inline] device_links_driver_bound+0x4ab/0x1440 drivers/base/core.c:1397 driver_bound+0xd8/0x2e0 drivers/base/dd.c:457 really_probe+0x774/0xae0 drivers/base/dd.c:756 __driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868 driver_probe_device+0x4f/0x240 drivers/base/dd.c:898 __device_attach_driver+0x270/0x410 drivers/base/dd.c:1026 bus_for_each_drv+0x258/0x2f0 drivers/base/bus.c:503 __device_attach+0x2c4/0x450 drivers/base/dd.c:1098 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1153 bus_probe_device+0x12a/0x220 drivers/base/bus.c:623 device_add+0x7d7/0xb80 drivers/base/core.c:3776 faux_device_create_with_groups+0x1a5/0x2b0 drivers/base/faux.c:161 regulator_dummy_init+0x19/0x40 drivers/regulator/dummy.c:67 regulator_init+0xca/0x110 drivers/regulator/core.c:6798 do_one_initcall+0x250/0x870 init/main.c:1360 do_initcall_level+0x10a/0x1a0 init/main.c:1422 do_initcalls+0x59/0xa0 init/main.c:1438 kernel_init_freeable+0x29d/0x3e0 init/main.c:1673 kernel_init+0x22/0x1d0 init/main.c:1563 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #0 (&root->kernfs_supers_rwsem){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 down_read+0x45/0x320 kernel/locking/rwsem.c:1574 kernfs_remove+0x35/0x80 fs/kernfs/dir.c:1621 __kobject_del+0xe0/0x310 lib/kobject.c:604 kobject_del+0x45/0x60 lib/kobject.c:627 cleanup_glue_dir+0x1a3/0x220 drivers/base/core.c:3486 device_del+0x77d/0x8f0 drivers/base/core.c:3986 device_unregister+0x21/0xf0 drivers/base/core.c:4006 wakeup_source_unregister+0x159/0x3f0 drivers/base/power/wakeup.c:239 device_pm_remove+0x1b4/0x310 drivers/base/power/main.c:181 device_del+0x52c/0x8f0 drivers/base/core.c:3966 usb_disable_device+0x3d4/0x8d0 drivers/usb/core/message.c:1478 usb_disconnect+0x346/0x9a0 drivers/usb/core/hub.c:2355 hub_port_connect drivers/usb/core/hub.c:5425 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event+0x1bbb/0x4d30 drivers/usb/core/hub.c:5971 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Chain exists of: &root->kernfs_supers_rwsem --> cpuhp_state-up --> gdp_mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(gdp_mutex); lock(cpuhp_state-up); lock(gdp_mutex); rlock(&root->kernfs_supers_rwsem); *** DEADLOCK *** locks held by kworker/0:3/5689: 5, last CPU#0: #0: ffff8880232a1548 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline] #0: ffff8880232a1548 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #0: ffff8880232a1548 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3460 [inline] #0: ffff8880232a1548 ((wq_completion)usb_hub_wq){+.+.}-{0:0}, at: process_scheduled_works+0x97a/0x1630 kernel/workqueue.c:3578 #1: ffffc90003fdfc40 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:309 [inline] #1: ffffc90003fdfc40 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: rcu_read_lock include/linux/rcupdate.h:849 [inline] #1: ffffc90003fdfc40 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: process_one_work kernel/workqueue.c:3460 [inline] #1: ffffc90003fdfc40 ((work_completion)(&hub->events)){+.+.}-{0:0}, at: process_scheduled_works+0x97a/0x1630 kernel/workqueue.c:3578 #2: ffff888029bf01d8 (&dev->mutex){....}-{4:4}, at: device_lock include/linux/device.h:1104 [inline] #2: ffff888029bf01d8 (&dev->mutex){....}-{4:4}, at: hub_event+0x184/0x4d30 drivers/usb/core/hub.c:5917 #3: ffff88802e5631d8 (&dev->mutex){....}-{4:4}, at: device_lock include/linux/device.h:1104 [inline] #3: ffff88802e5631d8 (&dev->mutex){....}-{4:4}, at: usb_disconnect+0xfc/0x9a0 drivers/usb/core/hub.c:2346 #4: ffffffff8fc1e680 (gdp_mutex){+.+.}-{4:4}, at: cleanup_glue_dir+0xc3/0x220 drivers/base/core.c:3435 stack backtrace: CPU: 0 UID: 0 PID: 5689 Comm: kworker/0:3 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/2026 Workqueue: usb_hub_wq hub_event Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 down_read+0x45/0x320 kernel/locking/rwsem.c:1574 kernfs_remove+0x35/0x80 fs/kernfs/dir.c:1621 __kobject_del+0xe0/0x310 lib/kobject.c:604 kobject_del+0x45/0x60 lib/kobject.c:627 cleanup_glue_dir+0x1a3/0x220 drivers/base/core.c:3486 device_del+0x77d/0x8f0 drivers/base/core.c:3986 device_unregister+0x21/0xf0 drivers/base/core.c:4006 wakeup_source_unregister+0x159/0x3f0 drivers/base/power/wakeup.c:239 device_pm_remove+0x1b4/0x310 drivers/base/power/main.c:181 device_del+0x52c/0x8f0 drivers/base/core.c:3966 usb_disable_device+0x3d4/0x8d0 drivers/usb/core/message.c:1478 usb_disconnect+0x346/0x9a0 drivers/usb/core/hub.c:2355 hub_port_connect drivers/usb/core/hub.c:5425 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event+0x1bbb/0x4d30 drivers/usb/core/hub.c:5971 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245