[Devel] [PATCH RHEL7 COMMIT] cgroup: Fixed null pointer dereference at cgroup_mount #PSBM-107596
Vasily Averin
vvs at virtuozzo.com
Fri Sep 4 10:31:29 MSK 2020
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.16
------>
commit c0b641f9bab3fda5bce3a125c64c0d947b2030f5
Author: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Date: Fri Sep 4 10:31:29 2020 +0300
cgroup: Fixed null pointer dereference at cgroup_mount #PSBM-107596
At cgroup_mount new_root a call to cgroup_root_from_opts may return
early and not allocate a new cgroup root object, instead returning NULL.
In that case we should not initialize ve_owner field for cgroup root.
https://jira.sw.ru/browse/PSBM-107596
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
kernel/cgroup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5f311180..691505c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1749,6 +1749,9 @@ static struct cgroupfs_root *cgroup_root_from_opts(struct cgroup_sb_opts *opts)
strcpy(root->name, opts->name);
if (opts->cpuset_clone_children)
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->top_cgroup.flags);
+
+ RCU_INIT_POINTER(root->top_cgroup.ve_owner, &ve0);
+
return root;
}
@@ -1859,7 +1862,6 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type,
goto drop_modules;
}
- RCU_INIT_POINTER(new_root->top_cgroup.ve_owner, &ve0);
opts.new_root = new_root;
/* Locate an existing or new sb for this hierarchy */
More information about the Devel
mailing list