hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I93ZFV
----------------------------------------------------------------------
In update_cpumask function, retal is lost when validate_change return error, so return retval at last. In update_exclusive_cpumask, it should go to out_free when validate_change return error, in case of tmp leaking.
Signed-off-by: Chen Ridong chenridong@huawei.com --- kernel/cgroup/cpuset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index e961c43f6e49..1addaacd832f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2519,7 +2519,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs, update_partition_sd_lb(cs, old_prs); out_free: free_cpumasks(NULL, &tmp); - return 0; + return retval; }
/** @@ -2570,7 +2570,7 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs,
retval = validate_change(cs, trialcs); if (retval) - return retval; + goto out_free;
if (is_partition_valid(cs)) { if (cpumask_empty(trialcs->effective_xcpus)) { @@ -2620,8 +2620,9 @@ static int update_exclusive_cpumask(struct cpuset *cs, struct cpuset *trialcs, if (cs->partition_root_state) update_partition_sd_lb(cs, old_prs);
+out_free: free_cpumasks(NULL, &tmp); - return 0; + return retval; }
/*