Skip to content

Commit 61e960b

Browse files
Chen Zhouhtejun
authored andcommitted
cgroup-v1: add disabled controller check in cgroup1_parse_param()
When mounting a cgroup hierarchy with disabled controller in cgroup v1, all available controllers will be attached. For example, boot with cgroup_no_v1=cpu or cgroup_disable=cpu, and then mount with "mount -t cgroup -ocpu cpu /sys/fs/cgroup/cpu", then all enabled controllers will be attached except cpu. Fix this by adding disabled controller check in cgroup1_parse_param(). If the specified controller is disabled, just return error with information "Disabled controller xx" rather than attaching all the other enabled controllers. Fixes: f5dfb53 ("cgroup: take options parsing into ->parse_monolithic()") Signed-off-by: Chen Zhou <[email protected]> Reviewed-by: Zefan Li <[email protected]> Reviewed-by: Michal Koutný <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent f4e087c commit 61e960b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/cgroup/cgroup-v1.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,9 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param)
917917
for_each_subsys(ss, i) {
918918
if (strcmp(param->key, ss->legacy_name))
919919
continue;
920+
if (!cgroup_ssid_enabled(i) || cgroup1_ssid_disabled(i))
921+
return invalfc(fc, "Disabled controller '%s'",
922+
param->key);
920923
ctx->subsys_mask |= (1 << i);
921924
return 0;
922925
}

0 commit comments

Comments
 (0)