提交 d791cf33 编写于 作者: H Hui Tang 提交者: zhangchangzhong

sched: Fix memory leak on error branch

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7EBNA
CVE: NA

-------------------------------

Fix memory leak on error branch for smart grid.

Fixes: 713cfd26 ("sched: Introduce smart grid scheduling strategy for cfs")
Signed-off-by: NHui Tang <tanghui20@huawei.com>
Reviewed-by: NZhang Qiao <zhangqiao22@huawei.com>
Signed-off-by: NZhang Changzhong <zhangchangzhong@huawei.com>
上级 b43a1c9e
...@@ -5628,7 +5628,6 @@ static int init_affinity_domains(struct affinity_domain *ad) ...@@ -5628,7 +5628,6 @@ static int init_affinity_domains(struct affinity_domain *ad)
} }
if (!sd) { if (!sd) {
ad->dcount = 0;
rcu_read_unlock(); rcu_read_unlock();
return -EINVAL; return -EINVAL;
} }
...@@ -5636,9 +5635,11 @@ static int init_affinity_domains(struct affinity_domain *ad) ...@@ -5636,9 +5635,11 @@ static int init_affinity_domains(struct affinity_domain *ad)
for (i = 0; i < dcount; i++) { for (i = 0; i < dcount; i++) {
ad->domains[i] = kmalloc(sizeof(cpumask_t), GFP_KERNEL); ad->domains[i] = kmalloc(sizeof(cpumask_t), GFP_KERNEL);
if (!ad->domains[i]) if (!ad->domains[i]) {
ad->dcount = i;
goto err; goto err;
} }
}
rcu_read_lock(); rcu_read_lock();
idlest = sd_find_idlest_group(sd); idlest = sd_find_idlest_group(sd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册