============================================ WARNING: possible recursive locking detected syzkaller #0 Tainted: G L -------------------------------------------- syz.7.2832/16004 is trying to acquire lock: ffff88801ef58e18 (kn->active#130){++++}-{0:0}, at: __kernfs_remove+0x34c/0xbc0 fs/kernfs/dir.c:1578 but task is already holding lock: ffff88801ef58e18 (kn->active#130){++++}-{0:0}, at: sysfs_unbreak_active_protection+0x21/0x40 fs/sysfs/file.c:496 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(kn->active#130); lock(kn->active#130); *** DEADLOCK *** May be due to missing lock nesting notation locks held by syz.7.2832/16004: 5, on CPU#2: #0: ffff88802a401cf0 (&f->f_pos_lock){+.+.}-{4:4}, at: fdget_pos+0x2aa/0x380 fs/file.c:1413 #1: ffff88802dfa4478 (sb_writers#8){.+.+}-{0:0}, at: ksys_write+0x12a/0x250 fs/read_write.c:719 #2: ffff88803a365d08 (&of->prealloc_mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x24d/0x5f0 fs/kernfs/file.c:320 #3: ffff88803a365c80 (&of->mutex){+.+.}-{4:4}, at: kernfs_fop_write_iter+0x2c2/0x5f0 fs/kernfs/file.c:336 #4: ffff88801ef58e18 (kn->active#130){++++}-{0:0}, at: sysfs_unbreak_active_protection+0x21/0x40 fs/sysfs/file.c:496 stack backtrace: CPU: 2 UID: 0 PID: 16004 Comm: syz.7.2832 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_deadlock_bug.cold+0xbd/0xca kernel/locking/lockdep.c:3085 check_deadlock kernel/locking/lockdep.c:3137 [inline] validate_chain kernel/locking/lockdep.c:3939 [inline] __lock_acquire+0x13f4/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 kernfs_drain+0x4eb/0x600 fs/kernfs/dir.c:534 __kernfs_remove+0x34c/0xbc0 fs/kernfs/dir.c:1578 kernfs_remove_by_name_ns+0x7c/0x120 fs/kernfs/dir.c:1796 kernfs_remove_by_name include/linux/kernfs.h:644 [inline] remove_files+0x96/0x1c0 fs/sysfs/group.c:28 sysfs_remove_group+0x8b/0x1b0 fs/sysfs/group.c:328 sysfs_remove_groups fs/sysfs/group.c:352 [inline] sysfs_remove_groups+0x60/0xb0 fs/sysfs/group.c:344 __kobject_del+0x89/0x220 lib/kobject.c:595 kobject_cleanup lib/kobject.c:680 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x348/0x640 lib/kobject.c:737 md_attr_store+0x283/0x330 drivers/md/md.c:6173 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:575 [inline] vfs_write+0x6af/0x1040 fs/read_write.c:667 ksys_write+0x12a/0x250 fs/read_write.c:719 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff18d1a9559 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff18e115028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007ff18d426090 RCX: 00007ff18d1a9559 RDX: 0000000000000005 RSI: 0000200000000040 RDI: 0000000000000007 RBP: 00007ff18d238136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ff18d426128 R14: 00007ff18d426090 R15: 00007ffcc45db5a8