====================================================== WARNING: possible circular locking dependency detected 6.1.23-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/21350 is trying to acquire lock: ffff0001238520a8 ((&sq->pending_timer)){+.-.}-{0:0}, at: del_timer_sync+0x74/0x210 kernel/time/timer.c:1417 but task is already holding lock: ffff8000197b2b30 (&blkcg->lock){....}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline] ffff8000197b2b30 (&blkcg->lock){....}-{2:2}, at: blkcg_deactivate_policy+0x1ac/0x4a8 block/blk-cgroup.c:1473 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+0x54/0x6c kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] blkg_create+0x9f4/0x1158 block/blk-cgroup.c:320 blkcg_init_disk+0xd0/0x318 block/blk-cgroup.c:1239 __alloc_disk_node+0x26c/0x484 block/genhd.c:1404 __blk_alloc_disk+0x40/0xbc block/genhd.c:1443 brd_alloc+0x2ac/0x5c8 drivers/block/brd.c:397 brd_init+0x108/0x1c4 drivers/block/brd.c:484 do_one_initcall+0x260/0xacc init/main.c:1303 do_initcall_level+0x154/0x214 init/main.c:1376 do_initcalls+0x58/0xac init/main.c:1392 do_basic_setup+0x8c/0xa0 init/main.c:1411 kernel_init_freeable+0x3a4/0x528 init/main.c:1631 kernel_init+0x24/0x29c init/main.c:1519 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 -> #1 (&q->queue_lock){..-.}-{2:2}: __raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline] _raw_spin_lock_irq+0x70/0x9c kernel/locking/spinlock.c:170 spin_lock_irq include/linux/spinlock.h:375 [inline] throtl_pending_timer_fn+0x104/0xdcc block/blk-throttle.c:1193 call_timer_fn+0x1c0/0xa1c kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers+0x554/0x718 kernel/time/timer.c:1790 run_timer_softirq+0x7c/0x114 kernel/time/timer.c:1803 __do_softirq+0x30c/0xea0 kernel/softirq.c:571 ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:79 call_on_irq_stack+0x2c/0x54 arch/arm64/kernel/entry.S:889 do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:84 invoke_softirq kernel/softirq.c:452 [inline] __irq_exit_rcu+0x28c/0x534 kernel/softirq.c:650 irq_exit_rcu+0x14/0x84 kernel/softirq.c:662 __el1_irq arch/arm64/kernel/entry-common.c:472 [inline] el1_interrupt+0x38/0x68 arch/arm64/kernel/entry-common.c:486 el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:491 el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:577 task_stack_page include/linux/sched/task_stack.h:21 [inline] unwind_next arch/arm64/kernel/stacktrace.c:86 [inline] unwind+0x54/0x214 arch/arm64/kernel/stacktrace.c:129 arch_stack_walk+0x17c/0x1c8 arch/arm64/kernel/stacktrace.c:231 stack_trace_save+0xfc/0x1a0 kernel/stacktrace.c:122 kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:52 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] kmem_cache_free+0x2f0/0x588 mm/slub.c:3683 kfree_skbmem+0x10c/0x19c __kfree_skb net/core/skbuff.c:869 [inline] consume_skb+0xa8/0x178 net/core/skbuff.c:1033 skb_free_datagram+0x20/0x30 net/core/datagram.c:322 netlink_recvmsg+0x488/0xde4 net/netlink/af_netlink.c:2008 ____sys_recvmsg+0x234/0x69c ___sys_recvmsg net/socket.c:2743 [inline] __sys_recvmsg+0x27c/0x350 net/socket.c:2773 __do_sys_recvmsg net/socket.c:2783 [inline] __se_sys_recvmsg net/socket.c:2780 [inline] __arm64_sys_recvmsg+0x80/0x94 net/socket.c:2780 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 -> #0 ((&sq->pending_timer)){+.-.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain kernel/locking/lockdep.c:3832 [inline] __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669 del_timer_sync+0x9c/0x210 kernel/time/timer.c:1417 throtl_pd_free+0x20/0x48 block/blk-throttle.c:493 blkcg_deactivate_policy+0x2cc/0x4a8 block/blk-cgroup.c:1477 blk_throtl_exit+0x9c/0x13c block/blk-throttle.c:2406 blkcg_init_disk+0x2a4/0x318 block/blk-cgroup.c:1263 __alloc_disk_node+0x26c/0x484 block/genhd.c:1404 __blk_mq_alloc_disk+0x114/0x1e4 block/blk-mq.c:4082 nbd_dev_add+0x314/0x938 drivers/block/nbd.c:1781 nbd_genl_connect+0x8fc/0x186c drivers/block/nbd.c:1964 genl_family_rcv_msg_doit net/netlink/genetlink.c:756 [inline] genl_family_rcv_msg net/netlink/genetlink.c:833 [inline] genl_rcv_msg+0x948/0xc2c net/netlink/genetlink.c:850 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2550 genl_rcv+0x38/0x50 net/netlink/genetlink.c:861 netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline] netlink_unicast+0x660/0x8d4 net/netlink/af_netlink.c:1354 netlink_sendmsg+0x834/0xb18 net/netlink/af_netlink.c:1931 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] ____sys_sendmsg+0x558/0x844 net/socket.c:2482 ___sys_sendmsg net/socket.c:2536 [inline] __sys_sendmsg+0x26c/0x33c net/socket.c:2565 __do_sys_sendmsg net/socket.c:2574 [inline] __se_sys_sendmsg net/socket.c:2572 [inline] __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2572 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 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-executor.3/21350: #0: ffff800017baec10 (cb_lock){++++}-{3:3}, at: genl_rcv+0x28/0x50 net/netlink/genetlink.c:860 #1: ffff800017baeac8 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline] #1: ffff800017baeac8 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x114/0xc2c net/netlink/genetlink.c:848 #2: ffff00013807d0a8 (&q->queue_lock){..-.}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline] #2: ffff00013807d0a8 (&q->queue_lock){..-.}-{2:2}, at: blkcg_deactivate_policy+0xf4/0x4a8 block/blk-cgroup.c:1466 #3: ffff8000197b2b30 (&blkcg->lock){....}-{2:2}, at: spin_lock include/linux/spinlock.h:350 [inline] #3: ffff8000197b2b30 (&blkcg->lock){....}-{2:2}, at: blkcg_deactivate_policy+0x1ac/0x4a8 block/blk-cgroup.c:1473 stack backtrace: CPU: 1 PID: 21350 Comm: syz-executor.3 Not tainted 6.1.23-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023 Call trace: dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 dump_stack+0x1c/0x5c lib/dump_stack.c:113 print_circular_bug+0x150/0x1b8 kernel/locking/lockdep.c:2056 check_noncircular+0x2cc/0x378 kernel/locking/lockdep.c:2178 check_prev_add kernel/locking/lockdep.c:3098 [inline] check_prevs_add kernel/locking/lockdep.c:3217 [inline] validate_chain kernel/locking/lockdep.c:3832 [inline] __lock_acquire+0x3338/0x764c kernel/locking/lockdep.c:5056 lock_acquire+0x26c/0x7cc kernel/locking/lockdep.c:5669 del_timer_sync+0x9c/0x210 kernel/time/timer.c:1417 throtl_pd_free+0x20/0x48 block/blk-throttle.c:493 blkcg_deactivate_policy+0x2cc/0x4a8 block/blk-cgroup.c:1477 blk_throtl_exit+0x9c/0x13c block/blk-throttle.c:2406 blkcg_init_disk+0x2a4/0x318 block/blk-cgroup.c:1263 __alloc_disk_node+0x26c/0x484 block/genhd.c:1404 __blk_mq_alloc_disk+0x114/0x1e4 block/blk-mq.c:4082 nbd_dev_add+0x314/0x938 drivers/block/nbd.c:1781 nbd_genl_connect+0x8fc/0x186c drivers/block/nbd.c:1964 genl_family_rcv_msg_doit net/netlink/genetlink.c:756 [inline] genl_family_rcv_msg net/netlink/genetlink.c:833 [inline] genl_rcv_msg+0x948/0xc2c net/netlink/genetlink.c:850 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2550 genl_rcv+0x38/0x50 net/netlink/genetlink.c:861 netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline] netlink_unicast+0x660/0x8d4 net/netlink/af_netlink.c:1354 netlink_sendmsg+0x834/0xb18 net/netlink/af_netlink.c:1931 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] ____sys_sendmsg+0x558/0x844 net/socket.c:2482 ___sys_sendmsg net/socket.c:2536 [inline] __sys_sendmsg+0x26c/0x33c net/socket.c:2565 __do_sys_sendmsg net/socket.c:2574 [inline] __se_sys_sendmsg net/socket.c:2572 [inline] __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2572 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581 nbd: failed to add new device