====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ kswapd0/78 is trying to acquire lock: ffff8880348e28c8 (&profile->lock){++++}-{4:4}, at: blk_crypto_hw_enter block/blk-crypto-profile.c:55 [inline] ffff8880348e28c8 (&profile->lock){++++}-{4:4}, at: __blk_crypto_evict_key+0x111/0x5e0 block/blk-crypto-profile.c:359 but task is already holding lock: ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:7177 [inline] ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xa08/0x32c0 mm/vmscan.c:7555 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4375 [inline] fs_reclaim_acquire+0x71/0x100 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] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_noprof+0xbc/0x720 mm/slub.c:5439 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] adiantum_setkey+0x139/0x620 crypto/adiantum.c:129 crypto_skcipher_setkey+0x2a3/0x460 crypto/skcipher.c:422 crypto_sync_skcipher_setkey include/crypto/skcipher.h:621 [inline] blk_crypto_fallback_keyslot_program+0x1ad/0x440 block/blk-crypto-fallback.c:122 blk_crypto_get_keyslot+0x941/0x1070 block/blk-crypto-profile.c:295 blk_crypto_fallback_encrypt_bio block/blk-crypto-fallback.c:362 [inline] blk_crypto_fallback_bio_prep+0x424/0x1b40 block/blk-crypto-fallback.c:505 blk_crypto_submit_bio include/linux/blk-crypto.h:211 [inline] f2fs_submit_write_bio+0x11b/0x2e0 fs/f2fs/data.c:575 __submit_merged_bio+0x258/0x6a0 fs/f2fs/data.c:590 __f2fs_submit_merged_write fs/f2fs/data.c:682 [inline] __submit_merged_write_cond+0x3c9/0x4e0 fs/f2fs/data.c:706 f2fs_submit_merged_write_cond fs/f2fs/data.c:731 [inline] f2fs_write_cache_pages fs/f2fs/data.c:3495 [inline] __f2fs_write_data_pages fs/f2fs/data.c:3603 [inline] f2fs_write_data_pages+0x2a27/0x36f0 fs/f2fs/data.c:3641 do_writepages+0x338/0x560 mm/page-writeback.c:2560 __writeback_single_inode+0x136/0x1220 fs/fs-writeback.c:1788 writeback_sb_inodes+0x9de/0x1b00 fs/fs-writeback.c:2099 __writeback_inodes_wb+0x114/0x240 fs/fs-writeback.c:2175 wb_writeback+0x42f/0xad0 fs/fs-writeback.c:2286 wb_check_start_all fs/fs-writeback.c:2412 [inline] wb_do_writeback fs/fs-writeback.c:2459 [inline] wb_workfn+0x980/0x10f0 fs/fs-writeback.c:2497 process_one_work kernel/workqueue.c:3387 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3470 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3551 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 -> #0 (&profile->lock){++++}-{4:4}: check_prev_add kernel/locking/lockdep.c:3181 [inline] check_prevs_add kernel/locking/lockdep.c:3300 [inline] validate_chain kernel/locking/lockdep.c:3924 [inline] __lock_acquire+0x15ff/0x2e50 kernel/locking/lockdep.c:5254 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908 down_write+0x96/0x200 kernel/locking/rwsem.c:1631 blk_crypto_hw_enter block/blk-crypto-profile.c:55 [inline] __blk_crypto_evict_key+0x111/0x5e0 block/blk-crypto-profile.c:359 blk_crypto_evict_key+0x230/0x3c0 block/blk-crypto.c:443 fscrypt_destroy_inline_crypt_key+0x1b9/0x260 fs/crypto/block.c:164 fscrypt_destroy_prepared_key fs/crypto/keysetup.c:173 [inline] put_crypt_info+0x110/0x2f0 fs/crypto/keysetup.c:560 fscrypt_put_encryption_info+0xf6/0x140 fs/crypto/keysetup.c:786 f2fs_evict_inode+0x1c9f/0x21f0 fs/f2fs/inode.c:1105 evict+0x624/0xb50 fs/inode.c:822 dispose_list fs/inode.c:864 [inline] prune_icache_sb+0x223/0x2d0 fs/inode.c:1011 super_cache_scan+0x3f5/0x500 fs/super.c:240 do_shrink_slab+0x6d0/0x10e0 mm/shrinker.c:443 shrink_slab_memcg mm/shrinker.c:560 [inline] shrink_slab+0x838/0x1220 mm/shrinker.c:638 shrink_one+0x2a2/0x730 mm/vmscan.c:5119 shrink_many mm/vmscan.c:5180 [inline] lru_gen_shrink_node mm/vmscan.c:5258 [inline] shrink_node+0x35d0/0x3e30 mm/vmscan.c:6247 kswapd_shrink_node mm/vmscan.c:7101 [inline] balance_pgdat mm/vmscan.c:7279 [inline] kswapd+0x185e/0x32c0 mm/vmscan.c:7555 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: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(&profile->lock); lock(fs_reclaim); lock(&profile->lock); *** DEADLOCK *** locks held by kswapd0/78: 2, last CPU#0: #0: ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:7177 [inline] #0: ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xa08/0x32c0 mm/vmscan.c:7555 #1: ffff888034bfc0e8 (&type->s_umount_key#53){.+.+}-{4:4}, at: super_trylock_shared fs/super.c:688 [inline] #1: ffff888034bfc0e8 (&type->s_umount_key#53){.+.+}-{4:4}, at: super_cache_scan+0x94/0x500 fs/super.c:213 stack backtrace: CPU: 0 UID: 0 PID: 78 Comm: kswapd0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2059 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2191 check_prev_add kernel/locking/lockdep.c:3181 [inline] check_prevs_add kernel/locking/lockdep.c:3300 [inline] validate_chain kernel/locking/lockdep.c:3924 [inline] __lock_acquire+0x15ff/0x2e50 kernel/locking/lockdep.c:5254 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908 down_write+0x96/0x200 kernel/locking/rwsem.c:1631 blk_crypto_hw_enter block/blk-crypto-profile.c:55 [inline] __blk_crypto_evict_key+0x111/0x5e0 block/blk-crypto-profile.c:359 blk_crypto_evict_key+0x230/0x3c0 block/blk-crypto.c:443 fscrypt_destroy_inline_crypt_key+0x1b9/0x260 fs/crypto/block.c:164 fscrypt_destroy_prepared_key fs/crypto/keysetup.c:173 [inline] put_crypt_info+0x110/0x2f0 fs/crypto/keysetup.c:560 fscrypt_put_encryption_info+0xf6/0x140 fs/crypto/keysetup.c:786 f2fs_evict_inode+0x1c9f/0x21f0 fs/f2fs/inode.c:1105 evict+0x624/0xb50 fs/inode.c:822 dispose_list fs/inode.c:864 [inline] prune_icache_sb+0x223/0x2d0 fs/inode.c:1011 super_cache_scan+0x3f5/0x500 fs/super.c:240 do_shrink_slab+0x6d0/0x10e0 mm/shrinker.c:443 shrink_slab_memcg mm/shrinker.c:560 [inline] shrink_slab+0x838/0x1220 mm/shrinker.c:638 shrink_one+0x2a2/0x730 mm/vmscan.c:5119 shrink_many mm/vmscan.c:5180 [inline] lru_gen_shrink_node mm/vmscan.c:5258 [inline] shrink_node+0x35d0/0x3e30 mm/vmscan.c:6247 kswapd_shrink_node mm/vmscan.c:7101 [inline] balance_pgdat mm/vmscan.c:7279 [inline] kswapd+0x185e/0x32c0 mm/vmscan.c:7555 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