====================================================== WARNING: possible circular locking dependency detected 5.18.0-rc4-next-20220427-syzkaller #0 Not tainted ------------------------------------------------------ kworker/1:5/3675 is trying to acquire lock: ffff888148a2e8e0 (&q->queue_lock){..-.}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:379 [inline] ffff888148a2e8e0 (&q->queue_lock){..-.}-{2:2}, at: throtl_pending_timer_fn+0xf7/0x1690 block/blk-throttle.c:1152 but task is already holding lock: ffffc900001f0d70 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:31 [inline] ffffc900001f0d70 ((&sq->pending_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x6b0 kernel/time/timer.c:1434 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 ((&sq->pending_timer)){+.-.}-{0:0}: del_timer_sync+0x5b/0x1b0 kernel/time/timer.c:1387 throtl_pd_free+0x15/0x40 block/blk-throttle.c:500 blkcg_deactivate_policy block/blk-cgroup.c:1445 [inline] blkcg_deactivate_policy+0x2d2/0x4e0 block/blk-cgroup.c:1423 blk_throtl_exit+0x8a/0x1a0 block/blk-throttle.c:2335 blkcg_init_queue+0x225/0x810 block/blk-cgroup.c:1226 __alloc_disk_node+0x260/0x610 block/genhd.c:1381 __blk_mq_alloc_disk+0x133/0x1c0 block/blk-mq.c:3931 nbd_dev_add+0x3b2/0xcd0 drivers/block/nbd.c:1762 nbd_genl_connect+0x11f3/0x1930 drivers/block/nbd.c:1945 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline] genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:725 ____sys_sendmsg+0x6e2/0x800 net/socket.c:2445 ___sys_sendmsg+0xf3/0x170 net/socket.c:2499 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2528 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 -> #1 (&blkcg->lock){....}-{2:2}: __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:354 [inline] blkg_create+0x47b/0x1030 block/blk-cgroup.c:301 blkcg_init_queue+0xfe/0x810 block/blk-cgroup.c:1206 __alloc_disk_node+0x260/0x610 block/genhd.c:1381 __blk_alloc_disk+0x35/0x70 block/genhd.c:1421 brd_alloc.part.0+0x27f/0x7a0 drivers/block/brd.c:391 brd_alloc drivers/block/brd.c:374 [inline] brd_init+0x1b8/0x24b drivers/block/brd.c:477 do_one_initcall+0x103/0x650 init/main.c:1303 do_initcall_level init/main.c:1378 [inline] do_initcalls init/main.c:1394 [inline] do_basic_setup init/main.c:1413 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1620 kernel_init+0x1a/0x1d0 init/main.c:1509 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 -> #0 (&q->queue_lock){..-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3095 [inline] check_prevs_add kernel/locking/lockdep.c:3214 [inline] validate_chain kernel/locking/lockdep.c:3829 [inline] __lock_acquire+0x2abe/0x5660 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5665 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5630 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline] _raw_spin_lock_irq+0x32/0x50 kernel/locking/spinlock.c:170 spin_lock_irq include/linux/spinlock.h:379 [inline] throtl_pending_timer_fn+0xf7/0x1690 block/blk-throttle.c:1152 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1444 expire_timers kernel/time/timer.c:1489 [inline] __run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1760 __run_timers kernel/time/timer.c:1738 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1773 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:649 preempt_schedule_irq+0x49/0x90 kernel/sched/core.c:6729 irqentry_exit+0x31/0x80 kernel/entry/common.c:428 asm_sysvec_reschedule_ipi+0x12/0x20 arch/x86/include/asm/idtentry.h:654 arch_local_irq_restore arch/x86/include/asm/irqflags.h:137 [inline] lockdep_unregister_key+0x279/0x460 kernel/locking/lockdep.c:6355 wq_unregister_lockdep kernel/workqueue.c:3512 [inline] pwq_unbound_release_workfn+0x254/0x340 kernel/workqueue.c:3750 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 other info that might help us debug this: Chain exists of: &q->queue_lock --> &blkcg->lock --> (&sq->pending_timer) Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((&sq->pending_timer)); lock(&blkcg->lock); lock((&sq->pending_timer)); lock(&q->queue_lock); *** DEADLOCK *** 3 locks held by kworker/1:5/3675: #0: ffff888010c64d38 ((wq_completion)events){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888010c64d38 ((wq_completion)events){+.+.}-{0:0}, at: arch_atomic_long_set include/linux/atomic/atomic-long.h:41 [inline] #0: ffff888010c64d38 ((wq_completion)events){+.+.}-{0:0}, at: atomic_long_set include/linux/atomic/atomic-instrumented.h:1280 [inline] #0: ffff888010c64d38 ((wq_completion)events){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:636 [inline] #0: ffff888010c64d38 ((wq_completion)events){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:663 [inline] #0: ffff888010c64d38 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x87a/0x1610 kernel/workqueue.c:2260 #1: ffffc900040dfda8 ((work_completion)(&pwq->unbound_release_work)){+.+.}-{0:0}, at: process_one_work+0x8ae/0x1610 kernel/workqueue.c:2264 #2: ffffc900001f0d70 ((&sq->pending_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:31 [inline] #2: ffffc900001f0d70 ((&sq->pending_timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x6b0 kernel/time/timer.c:1434 stack backtrace: CPU: 1 PID: 3675 Comm: kworker/1:5 Not tainted 5.18.0-rc4-next-20220427-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events pwq_unbound_release_workfn Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3095 [inline] check_prevs_add kernel/locking/lockdep.c:3214 [inline] validate_chain kernel/locking/lockdep.c:3829 [inline] __lock_acquire+0x2abe/0x5660 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5665 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5630 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline] _raw_spin_lock_irq+0x32/0x50 kernel/locking/spinlock.c:170 spin_lock_irq include/linux/spinlock.h:379 [inline] throtl_pending_timer_fn+0xf7/0x1690 block/blk-throttle.c:1152 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1444 expire_timers kernel/time/timer.c:1489 [inline] __run_timers.part.0+0x679/0xa80 kernel/time/timer.c:1760 __run_timers kernel/time/timer.c:1738 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1773 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1106 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:preempt_schedule_irq+0x49/0x90 kernel/sched/core.c:6729 Code: 55 53 65 48 8b 1c 25 00 70 02 00 48 89 dd 48 c1 ed 03 48 01 c5 bf 01 00 00 00 e8 b2 e4 dc f7 e8 1d b3 0b f8 fb bf 01 00 00 00 32 a6 ff ff 9c 58 fa f6 c4 02 75 27 bf 01 00 00 00 e8 b0 cb dc RSP: 0018:ffffc900040dfb68 EFLAGS: 00000206 RAX: 000000000002af8b RBX: ffff88801d109d40 RCX: 1ffffffff201332e RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffffed1003a213a8 R08: 0000000000000001 R09: ffffffff900888af R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 irqentry_exit+0x31/0x80 kernel/entry/common.c:428 asm_sysvec_reschedule_ipi+0x12/0x20 arch/x86/include/asm/idtentry.h:654 RIP: 0010:lockdep_unregister_key+0x279/0x460 kernel/locking/lockdep.c:6358 Code: e8 ec ea ff ff 4c 89 e7 e8 e4 c6 ff ff e8 8f c7 ff ff 9c 58 f6 c4 02 0f 85 43 01 00 00 41 f7 c6 00 02 00 00 0f 85 ec 00 00 00 22 79 08 00 48 b8 00 00 00 00 00 fc ff df 49 c7 44 05 00 00 00 RSP: 0018:ffffc900040dfc38 EFLAGS: 00000206 RAX: 0000000000000046 RBX: ffff888077d07128 RCX: 0000000000000001 RDX: dffffc0000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffff888077d07128 R08: ffffffff8bd8f440 R09: ffffffff907ea3d3 R10: fffffbfff20fd47a R11: 000000000001206f R12: ffffffff90080838 R13: 1ffff9200081bf88 R14: 0000000000000246 R15: ffffffff902104d0 wq_unregister_lockdep kernel/workqueue.c:3512 [inline] pwq_unbound_release_workfn+0x254/0x340 kernel/workqueue.c:3750 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 ---------------- Code disassembly (best guess): 0: 55 push %rbp 1: 53 push %rbx 2: 65 48 8b 1c 25 00 70 mov %gs:0x27000,%rbx 9: 02 00 b: 48 89 dd mov %rbx,%rbp e: 48 c1 ed 03 shr $0x3,%rbp 12: 48 01 c5 add %rax,%rbp 15: bf 01 00 00 00 mov $0x1,%edi 1a: e8 b2 e4 dc f7 callq 0xf7dce4d1 1f: e8 1d b3 0b f8 callq 0xf80bb341 24: fb sti 25: bf 01 00 00 00 mov $0x1,%edi * 2a: e8 32 a6 ff ff callq 0xffffa661 <-- trapping instruction 2f: 9c pushfq 30: 58 pop %rax 31: fa cli 32: f6 c4 02 test $0x2,%ah 35: 75 27 jne 0x5e 37: bf 01 00 00 00 mov $0x1,%edi 3c: e8 .byte 0xe8 3d: b0 cb mov $0xcb,%al 3f: dc .byte 0xdc