====================================================== WARNING: possible circular locking dependency detected 6.0.0-syzkaller-02734-g0326074ff465 #0 Not tainted ------------------------------------------------------ syz-executor173/3734 is trying to acquire lock: ffff8881477f90a8 ((&sq->pending_timer)){+.-.}-{0:0}, at: del_timer_sync+0x33/0x1b0 kernel/time/timer.c:1416 but task is already holding lock: ffffffff9135d270 (&blkcg->lock){....}-{2:2}, at: spin_lock include/linux/spinlock.h:349 [inline] ffffffff9135d270 (&blkcg->lock){....}-{2:2}, at: blkcg_deactivate_policy block/blk-cgroup.c:1519 [inline] ffffffff9135d270 (&blkcg->lock){....}-{2:2}, at: blkcg_deactivate_policy+0x181/0x470 block/blk-cgroup.c:1501 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&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:349 [inline] blkg_create+0x461/0x1020 block/blk-cgroup.c:344 blkcg_init_queue+0xb2/0x620 block/blk-cgroup.c:1285 __alloc_disk_node+0x29d/0x650 block/genhd.c:1367 __blk_alloc_disk+0x35/0x90 block/genhd.c:1406 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+0xfe/0x650 init/main.c:1296 do_initcall_level init/main.c:1369 [inline] do_initcalls init/main.c:1385 [inline] do_basic_setup init/main.c:1404 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1623 kernel_init+0x1a/0x1d0 init/main.c:1512 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 -> #1 (&q->queue_lock){..-.}-{2:2}: __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:374 [inline] throtl_pending_timer_fn+0xf7/0x1690 block/blk-throttle.c:1152 call_timer_fn+0x1a0/0x6b0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers.part.0+0x674/0xa80 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1d0/0x9c8 kernel/softirq.c:571 do_softirq.part.0+0xde/0x130 kernel/softirq.c:472 do_softirq kernel/softirq.c:464 [inline] __local_bh_enable_ip+0x102/0x120 kernel/softirq.c:396 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:808 [inline] ip_finish_output2+0x7d0/0x2170 net/ipv4/ip_output.c:229 __ip_finish_output net/ipv4/ip_output.c:306 [inline] __ip_finish_output+0x396/0x650 net/ipv4/ip_output.c:288 ip_finish_output+0x2d/0x280 net/ipv4/ip_output.c:316 NF_HOOK_COND include/linux/netfilter.h:291 [inline] ip_output+0x19f/0x310 net/ipv4/ip_output.c:430 dst_output include/net/dst.h:445 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] __ip_queue_xmit+0x8de/0x1be0 net/ipv4/ip_output.c:532 __tcp_transmit_skb+0x1967/0x3800 net/ipv4/tcp_output.c:1402 tcp_transmit_skb net/ipv4/tcp_output.c:1420 [inline] tcp_write_xmit+0x1025/0x6140 net/ipv4/tcp_output.c:2696 __tcp_push_pending_frames+0xaa/0x380 net/ipv4/tcp_output.c:2880 tcp_push+0x499/0x720 net/ipv4/tcp.c:728 tcp_sendmsg_locked+0x1fd9/0x2940 net/ipv4/tcp.c:1454 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1482 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 sock_write_iter+0x291/0x3d0 net/socket.c:1108 call_write_iter include/linux/fs.h:2187 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x9e9/0xdd0 fs/read_write.c:584 ksys_write+0x1e8/0x250 fs/read_write.c:637 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+0x63/0xcd -> #0 ((&sq->pending_timer)){+.-.}-{0:0}: 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+0x2a43/0x56d0 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 del_timer_sync+0x5b/0x1b0 kernel/time/timer.c:1417 throtl_pd_free+0x15/0x40 block/blk-throttle.c:500 blkcg_deactivate_policy block/blk-cgroup.c:1523 [inline] blkcg_deactivate_policy+0x26c/0x470 block/blk-cgroup.c:1501 blk_throtl_exit+0x8a/0x1a0 block/blk-throttle.c:2337 blkcg_init_queue+0x19b/0x620 block/blk-cgroup.c:1304 __alloc_disk_node+0x29d/0x650 block/genhd.c:1367 __blk_mq_alloc_disk+0x13b/0x1f0 block/blk-mq.c:3942 nbd_dev_add+0x3b2/0xc20 drivers/block/nbd.c:1781 nbd_genl_connect+0x12c5/0x19d0 drivers/block/nbd.c:1964 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731 genl_family_rcv_msg net/netlink/genetlink.c:808 [inline] genl_rcv_msg+0x441/0x780 net/netlink/genetlink.c:825 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2540 genl_rcv+0x24/0x40 net/netlink/genetlink.c:836 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 __sys_sendmsg+0xf3/0x1c0 net/socket.c:2565 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+0x63/0xcd other info that might help us debug this: Chain exists of: (&sq->pending_timer) --> &q->queue_lock --> &blkcg->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&blkcg->lock); lock(&q->queue_lock); lock(&blkcg->lock); lock((&sq->pending_timer)); *** DEADLOCK *** 4 locks held by syz-executor173/3734: #0: ffffffff8d8578b0 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:835 #1: ffffffff8d857968 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline] #1: ffffffff8d857968 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x509/0x780 net/netlink/genetlink.c:823 #2: ffff88807dff17a0 (&q->queue_lock){..-.}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:374 [inline] #2: ffff88807dff17a0 (&q->queue_lock){..-.}-{2:2}, at: blkcg_deactivate_policy block/blk-cgroup.c:1512 [inline] #2: ffff88807dff17a0 (&q->queue_lock){..-.}-{2:2}, at: blkcg_deactivate_policy+0x9b/0x470 block/blk-cgroup.c:1501 #3: ffffffff9135d270 (&blkcg->lock){....}-{2:2}, at: spin_lock include/linux/spinlock.h:349 [inline] #3: ffffffff9135d270 (&blkcg->lock){....}-{2:2}, at: blkcg_deactivate_policy block/blk-cgroup.c:1519 [inline] #3: ffffffff9135d270 (&blkcg->lock){....}-{2:2}, at: blkcg_deactivate_policy+0x181/0x470 block/blk-cgroup.c:1501 stack backtrace: CPU: 0 PID: 3734 Comm: syz-executor173 Not tainted 6.0.0-syzkaller-02734-g0326074ff465 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022 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+0x2a43/0x56d0 kernel/locking/lockdep.c:5053 lock_acquire kernel/locking/lockdep.c:5666 [inline] lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631 del_timer_sync+0x5b/0x1b0 kernel/time/timer.c:1417 throtl_pd_free+0x15/0x40 block/blk-throttle.c:500 blkcg_deactivate_policy block/blk-cgroup.c:1523 [inline] blkcg_deactivate_policy+0x26c/0x470 block/blk-cgroup.c:1501 blk_throtl_exit+0x8a/0x1a0 block/blk-throttle.c:2337 blkcg_init_queue+0x19b/0x620 block/blk-cgroup.c:1304 __alloc_disk_node+0x29d/0x650 block/genhd.c:1367 __blk_mq_alloc_disk+0x13b/0x1f0 block/blk-mq.c:3942 nbd_dev_add+0x3b2/0xc20 drivers/block/nbd.c:1781 nbd_genl_connect+0x12c5/0x19d0 drivers/block/nbd.c:1964 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731 genl_family_rcv_msg net/netlink/genetlink.c:808 [inline] genl_rcv_msg+0x441/0x780 net/netlink/genetlink.c:825 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2540 genl_rcv+0x24/0x40 net/netlink/genetlink.c:836 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:734 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536 __sys_sendmsg+0xf3/0x1c0 net/socket.c:2565 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+0x63/0xcd RIP: 0033:0x7f47f2ff4d39 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 00 00 90 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:00007fff0c3beaa8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f47f2ff4d39 RDX: 0000000000000000 RSI: 00000000200005c0 RDI: 0000000000000004 RBP: 00007fff0c3beac0 R08: 0000000000000002 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 431bde82d7b634db R14: 0000000000000000 R15: 0000000000000000 nbd: failed to add new device