====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ kworker/0:1H/1468 is trying to acquire lock: ffff800088694dc0 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:316 [inline] ffff800088694dc0 (fs_reclaim){+.+.}-{0:0}, at: slab_pre_alloc_hook mm/slub.c:4636 [inline] ffff800088694dc0 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc_node mm/slub.c:4974 [inline] ffff800088694dc0 (fs_reclaim){+.+.}-{0:0}, at: __kmalloc_cache_node_noprof+0x6c/0x630 mm/slub.c:5578 but task is already holding lock: ffff0000166b2480 (&new->lock){+.+.}-{4:4}, at: mtd_blktrans_work drivers/mtd/mtd_blkdevs.c:151 [inline] ffff0000166b2480 (&new->lock){+.+.}-{4:4}, at: mtd_queue_rq+0x2a4/0x1694 drivers/mtd/mtd_blkdevs.c:179 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #4 (&new->lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x3fc/0x478 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x150/0x153c kernel/locking/mutex.c:821 mutex_lock_nested+0x24/0x34 kernel/locking/mutex.c:874 mtd_blktrans_work drivers/mtd/mtd_blkdevs.c:151 [inline] mtd_queue_rq+0x2a4/0x1694 drivers/mtd/mtd_blkdevs.c:179 blk_mq_dispatch_rq_list+0x2e0/0x177c 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+0xc50/0xe60 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0x7c/0x114 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x204/0x4a0 block/blk-mq.c:2368 blk_mq_dispatch_list+0x36c/0xa88 block/blk-mq.c:2931 blk_mq_flush_plug_list block/blk-mq.c:2979 [inline] blk_mq_flush_plug_list+0xf0/0x520 block/blk-mq.c:2951 __blk_flush_plug+0x214/0x3d4 block/blk-core.c:1270 blk_finish_plug block/blk-core.c:1297 [inline] blk_finish_plug+0x5c/0xa8 block/blk-core.c:1294 read_pages+0x3d4/0x988 mm/readahead.c:187 page_cache_ra_order+0x4dc/0xdb8 mm/readahead.c:541 page_cache_sync_ra+0x6e8/0xae0 mm/readahead.c:649 filemap_get_pages+0x278/0x16a0 mm/filemap.c:2714 filemap_splice_read+0x3a8/0xb38 mm/filemap.c:3103 do_splice_read fs/splice.c:980 [inline] do_splice_read+0x1bc/0x370 fs/splice.c:954 splice_direct_to_actor+0x21c/0x860 fs/splice.c:1084 do_splice_direct_actor fs/splice.c:1202 [inline] do_splice_direct+0x114/0x1e0 fs/splice.c:1228 do_sendfile+0x794/0xbd8 fs/read_write.c:1371 __do_sys_sendfile64 fs/read_write.c:1432 [inline] __se_sys_sendfile64 fs/read_write.c:1418 [inline] __arm64_sys_sendfile64+0x214/0x254 fs/read_write.c:1418 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x74/0x240 arch/arm64/kernel/syscall.c:49 el0_svc_common.constprop.0+0xac/0x230 arch/arm64/kernel/syscall.c:121 do_el0_svc+0x40/0x58 arch/arm64/kernel/syscall.c:140 el0_svc+0x58/0x2ac arch/arm64/kernel/entry-common.c:758 el0t_64_sync_handler+0xa0/0xe4 arch/arm64/kernel/entry-common.c:777 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590 -> #3 (set->srcu){.+.+}-{0:0}: lock_sync+0x100/0x1a0 kernel/locking/lockdep.c:5991 srcu_lock_sync include/linux/srcu.h:210 [inline] __synchronize_srcu+0xa8/0x280 kernel/rcu/srcutree.c:1462 synchronize_srcu_expedited kernel/rcu/srcutree.c:1502 [inline] synchronize_srcu+0x168/0x7d0 kernel/rcu/srcutree.c:1558 blk_mq_wait_quiesce_done block/blk-mq.c:284 [inline] blk_mq_wait_quiesce_done block/blk-mq.c:281 [inline] blk_mq_quiesce_queue block/blk-mq.c:304 [inline] blk_mq_quiesce_queue+0xf4/0x160 block/blk-mq.c:299 elevator_switch+0x118/0x430 block/elevator.c:576 elevator_change+0x294/0x420 block/elevator.c:681 elevator_set_default+0x210/0x2b8 block/elevator.c:754 blk_register_queue+0x36c/0x500 block/blk-sysfs.c:992 __add_disk+0x588/0xc00 block/genhd.c:531 add_disk_fwnode+0x110/0x3e0 block/genhd.c:600 device_add_disk+0x14/0x20 block/genhd.c:630 add_disk include/linux/blkdev.h:798 [inline] nbd_dev_add+0x5f8/0x9b4 drivers/block/nbd.c:2026 nbd_init+0x190/0x1b0 drivers/block/nbd.c:2743 do_one_initcall+0x134/0xb20 init/main.c:1362 do_initcall_level init/main.c:1424 [inline] do_initcalls init/main.c:1440 [inline] do_basic_setup init/main.c:1460 [inline] kernel_init_freeable+0x5e8/0x66c init/main.c:1675 kernel_init+0x2c/0x14c init/main.c:1565 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:854 -> #2 (&q->elevator_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x3fc/0x478 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x150/0x153c kernel/locking/mutex.c:821 mutex_lock_nested+0x24/0x34 kernel/locking/mutex.c:874 elevator_change+0x188/0x420 block/elevator.c:679 elevator_set_none+0x90/0xec block/elevator.c:769 blk_mq_elv_switch_none block/blk-mq.c:5113 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5158 [inline] blk_mq_update_nr_hw_queues+0x3c0/0x1020 block/blk-mq.c:5223 nbd_start_device+0x128/0xa28 drivers/block/nbd.c:1530 nbd_genl_connect+0xb50/0x1394 drivers/block/nbd.c:2310 genl_family_rcv_msg_doit+0x1c0/0x28c net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x3f8/0x60c net/netlink/genetlink.c:1209 netlink_rcv_skb+0x1ac/0x360 net/netlink/af_netlink.c:2575 genl_rcv+0x38/0x54 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1338 [inline] netlink_unicast+0x418/0x6e0 net/netlink/af_netlink.c:1364 netlink_sendmsg+0x638/0xa4c net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg+0xc8/0x1a4 net/socket.c:815 ____sys_sendmsg+0x52c/0x76c net/socket.c:2713 ___sys_sendmsg+0x124/0x1a4 net/socket.c:2767 __sys_sendmsg+0x10c/0x198 net/socket.c:2799 __do_sys_sendmsg net/socket.c:2804 [inline] __se_sys_sendmsg net/socket.c:2802 [inline] __arm64_sys_sendmsg+0x74/0xa4 net/socket.c:2802 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x74/0x240 arch/arm64/kernel/syscall.c:49 el0_svc_common.constprop.0+0xac/0x230 arch/arm64/kernel/syscall.c:121 do_el0_svc+0x40/0x58 arch/arm64/kernel/syscall.c:140 el0_svc+0x58/0x2ac arch/arm64/kernel/entry-common.c:758 el0t_64_sync_handler+0xa0/0xe4 arch/arm64/kernel/entry-common.c:777 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590 -> #1 (&q->q_usage_counter(io)#33){++++}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x3fc/0x478 kernel/locking/lockdep.c:5899 blk_alloc_queue+0x4e0/0x640 block/blk-core.c:504 blk_mq_alloc_queue+0x148/0x224 block/blk-mq.c:4431 __blk_mq_alloc_disk+0x20/0x120 block/blk-mq.c:4478 nbd_dev_add+0x3d0/0x9b4 drivers/block/nbd.c:1996 nbd_init+0x190/0x1b0 drivers/block/nbd.c:2743 do_one_initcall+0x134/0xb20 init/main.c:1362 do_initcall_level init/main.c:1424 [inline] do_initcalls init/main.c:1440 [inline] do_basic_setup init/main.c:1460 [inline] kernel_init_freeable+0x5e8/0x66c init/main.c:1675 kernel_init+0x2c/0x14c init/main.c:1565 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:854 -> #0 (fs_reclaim){+.+.}-{0:0}: check_prev_add+0x110/0xca0 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x148c/0x1aec kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x3fc/0x478 kernel/locking/lockdep.c:5899 __fs_reclaim_acquire mm/page_alloc.c:4375 [inline] fs_reclaim_acquire+0x130/0x158 mm/page_alloc.c:4389 might_alloc include/linux/sched/mm.h:316 [inline] slab_pre_alloc_hook mm/slub.c:4636 [inline] slab_alloc_node mm/slub.c:4974 [inline] __kmalloc_cache_node_noprof+0x6c/0x630 mm/slub.c:5578 _kmalloc_node_noprof include/linux/slab.h:1196 [inline] __get_vm_area_node+0x118/0x2ec mm/vmalloc.c:3237 __vmalloc_node_range_noprof+0x198/0xfd4 mm/vmalloc.c:4064 __vmalloc_node_noprof+0xe4/0x14c mm/vmalloc.c:4165 vmalloc_noprof+0x24/0x38 mm/vmalloc.c:4200 mtdblock_writesect+0x41c/0x5b8 drivers/mtd/mtdblock.c:242 do_blktrans_request drivers/mtd/mtd_blkdevs.c:88 [inline] mtd_blktrans_work drivers/mtd/mtd_blkdevs.c:152 [inline] mtd_queue_rq+0x744/0x1694 drivers/mtd/mtd_blkdevs.c:179 blk_mq_dispatch_rq_list+0x2e0/0x177c 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+0x830/0xe60 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0x7c/0x114 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0xf0/0x278 block/blk-mq.c:2544 process_one_work+0x830/0x1c00 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x42c/0xc90 kernel/workqueue.c:3560 kthread+0x2ec/0x384 kernel/kthread.c:436 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:854 other info that might help us debug this: Chain exists of: fs_reclaim --> set->srcu --> &new->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&new->lock); lock(set->srcu); lock(&new->lock); lock(fs_reclaim); *** DEADLOCK *** locks held by kworker/0:1H/1468: 4, last CPU#0: #0: ffff00000feb9140 ((wq_completion)kblockd){+.+.}-{0:0}, at: process_one_work+0x12ec/0x1c00 kernel/workqueue.c:3371 #1: ffff8000a0447c70 ((work_completion)(&(&hctx->run_work)->work)){+.+.}-{0:0}, at: process_one_work+0x780/0x1c00 kernel/workqueue.c:3370 #2: ffff000016773018 (set->srcu){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:304 [inline] #2: ffff000016773018 (set->srcu){.+.+}-{0:0}, at: blk_mq_run_work_fn+0xc8/0x278 block/blk-mq.c:2544 #3: ffff0000166b2480 (&new->lock){+.+.}-{4:4}, at: mtd_blktrans_work drivers/mtd/mtd_blkdevs.c:151 [inline] #3: ffff0000166b2480 (&new->lock){+.+.}-{4:4}, at: mtd_queue_rq+0x2a4/0x1694 drivers/mtd/mtd_blkdevs.c:179 stack backtrace: CPU: 0 UID: 0 PID: 1468 Comm: kworker/0:1H Tainted: G L syzkaller #0 PREEMPT Tainted: [L]=SOFTLOCKUP Hardware name: linux,dummy-virt (DT) Workqueue: kblockd blk_mq_run_work_fn Call trace: show_stack+0x18/0x24 arch/arm64/kernel/stacktrace.c:499 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x7c/0xb0 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 print_circular_bug+0x23c/0x284 kernel/locking/lockdep.c:2087 check_noncircular+0x174/0x194 kernel/locking/lockdep.c:2219 check_prev_add+0x110/0xca0 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x148c/0x1aec kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x3fc/0x478 kernel/locking/lockdep.c:5899 __fs_reclaim_acquire mm/page_alloc.c:4375 [inline] fs_reclaim_acquire+0x130/0x158 mm/page_alloc.c:4389 might_alloc include/linux/sched/mm.h:316 [inline] slab_pre_alloc_hook mm/slub.c:4636 [inline] slab_alloc_node mm/slub.c:4974 [inline] __kmalloc_cache_node_noprof+0x6c/0x630 mm/slub.c:5578 _kmalloc_node_noprof include/linux/slab.h:1196 [inline] __get_vm_area_node+0x118/0x2ec mm/vmalloc.c:3237 __vmalloc_node_range_noprof+0x198/0xfd4 mm/vmalloc.c:4064 __vmalloc_node_noprof+0xe4/0x14c mm/vmalloc.c:4165 vmalloc_noprof+0x24/0x38 mm/vmalloc.c:4200 mtdblock_writesect+0x41c/0x5b8 drivers/mtd/mtdblock.c:242 do_blktrans_request drivers/mtd/mtd_blkdevs.c:88 [inline] mtd_blktrans_work drivers/mtd/mtd_blkdevs.c:152 [inline] mtd_queue_rq+0x744/0x1694 drivers/mtd/mtd_blkdevs.c:179 blk_mq_dispatch_rq_list+0x2e0/0x177c 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+0x830/0xe60 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0x7c/0x114 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0xf0/0x278 block/blk-mq.c:2544 process_one_work+0x830/0x1c00 kernel/workqueue.c:3396 process_scheduled_works kernel/workqueue.c:3479 [inline] worker_thread+0x42c/0xc90 kernel/workqueue.c:3560 kthread+0x2ec/0x384 kernel/kthread.c:436 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:854