======================================================
WARNING: possible circular locking dependency detected
6.1.35-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/12699 is trying to acquire lock:
ffffffff8cdc4970 (cpu_hotplug_lock){++++}-{0:0}, at: static_key_slow_inc+0xe/0x20 kernel/jump_label.c:158
but task is already holding lock:
ffffffff8cf5a608 (freezer_mutex){+.+.}-{3:3}, at: freezer_css_online+0x4b/0x140 kernel/cgroup/legacy_freezer.c:111
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (freezer_mutex){+.+.}-{3:3}:
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
freezer_change_state kernel/cgroup/legacy_freezer.c:389 [inline]
freezer_write+0xa4/0x3f0 kernel/cgroup/legacy_freezer.c:429
cgroup_file_write+0x2c6/0x690 kernel/cgroup/cgroup.c:4057
kernfs_fop_write_iter+0x3a2/0x4f0 fs/kernfs/file.c:330
call_write_iter include/linux/fs.h:2205 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x7ae/0xba0 fs/read_write.c:584
ksys_write+0x19c/0x2c0 fs/read_write.c:637
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
-> #0 (cpu_hotplug_lock){++++}-{0:0}:
check_prev_add kernel/locking/lockdep.c:3098 [inline]
check_prevs_add kernel/locking/lockdep.c:3217 [inline]
validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
cpus_read_lock+0x3e/0x150 kernel/cpu.c:310
static_key_slow_inc+0xe/0x20 kernel/jump_label.c:158
freezer_css_online+0xc2/0x140 kernel/cgroup/legacy_freezer.c:117
online_css+0xba/0x260 kernel/cgroup/cgroup.c:5476
css_create kernel/cgroup/cgroup.c:5547 [inline]
cgroup_apply_control_enable+0x7d1/0xae0 kernel/cgroup/cgroup.c:3235
cgroup_mkdir+0xd8b/0xff0 kernel/cgroup/cgroup.c:5743
kernfs_iop_mkdir+0x275/0x400 fs/kernfs/dir.c:1196
vfs_mkdir+0x3b6/0x590 fs/namei.c:4036
do_mkdirat+0x260/0x520 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__x64_sys_mkdirat+0x85/0x90 fs/namei.c:4074
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(freezer_mutex);
lock(cpu_hotplug_lock);
lock(freezer_mutex);
lock(cpu_hotplug_lock);
*** DEADLOCK ***
4 locks held by syz-executor.2/12699:
#0: ffff88807bbbe460 (sb_writers#11){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
#1: ffff8880418f1aa0 (&type->i_mutex_dir_key#7/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
#1: ffff8880418f1aa0 (&type->i_mutex_dir_key#7/1){+.+.}-{3:3}, at: filename_create+0x256/0x530 fs/namei.c:3807
#2: ffffffff8cf4f6a8 (cgroup_mutex){+.+.}-{3:3}, at: cgroup_lock include/linux/cgroup.h:442 [inline]
#2: ffffffff8cf4f6a8 (cgroup_mutex){+.+.}-{3:3}, at: cgroup_kn_lock_live+0xe5/0x290 kernel/cgroup/cgroup.c:1667
#3: ffffffff8cf5a608 (freezer_mutex){+.+.}-{3:3}, at: freezer_css_online+0x4b/0x140 kernel/cgroup/legacy_freezer.c:111
stack backtrace:
CPU: 1 PID: 12699 Comm: syz-executor.2 Not tainted 6.1.35-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
check_noncircular+0x2fa/0x3b0 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+0x1667/0x58e0 kernel/locking/lockdep.c:3832
__lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
cpus_read_lock+0x3e/0x150 kernel/cpu.c:310
static_key_slow_inc+0xe/0x20 kernel/jump_label.c:158
freezer_css_online+0xc2/0x140 kernel/cgroup/legacy_freezer.c:117
online_css+0xba/0x260 kernel/cgroup/cgroup.c:5476
css_create kernel/cgroup/cgroup.c:5547 [inline]
cgroup_apply_control_enable+0x7d1/0xae0 kernel/cgroup/cgroup.c:3235
cgroup_mkdir+0xd8b/0xff0 kernel/cgroup/cgroup.c:5743
kernfs_iop_mkdir+0x275/0x400 fs/kernfs/dir.c:1196
vfs_mkdir+0x3b6/0x590 fs/namei.c:4036
do_mkdirat+0x260/0x520 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__x64_sys_mkdirat+0x85/0x90 fs/namei.c:4074
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f7e7088c389
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7e71561168 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f7e709abf80 RCX: 00007f7e7088c389
RDX: 00000000000001ff RSI: 0000000020000100 RDI: 0000000000000005
RBP: 00007f7e708d7493 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcfd232c3f R14: 00007f7e71561300 R15: 0000000000022000
</TASK>