hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9N7NY
----------------------------------------------------------------------
In alloc_cpumasks, pmask4 may be null if cs is null, so it may lead to null pointer reference. Just make sure pmask4 is not null before assessing it.
Fixes: 1e0b07acf6561 ("cgroup/cpuset: Add cpuset.cpus.exclusive for v2") Signed-off-by: Chen Ridong chenridong@huawei.com --- kernel/cgroup/cpuset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 53d2917a798c..d600566fb8e3 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -675,7 +675,8 @@ static inline int alloc_cpumasks(struct cpuset *cs, struct tmpmasks *tmp)
#ifdef CONFIG_QOS_SCHED_DYNAMIC_AFFINITY free_four: - free_cpumask_var(*pmask4); + if (pmask4) + free_cpumask_var(*pmask4); #endif free_three: free_cpumask_var(*pmask3);