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

sched: Fix memory leak for smart grid

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

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

Free ad->domains_orig[] in 'free_affinity_domains',
otherwise the memory will leak.

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>
上级 4f3df479
......@@ -5584,7 +5584,9 @@ void free_affinity_domains(struct affinity_domain *ad)
for (i = 0; i < ad->dcount; i++) {
kfree(ad->domains[i]);
kfree(ad->domains_orig[i]);
ad->domains[i] = NULL;
ad->domains_orig[i] = NULL;
}
ad->dcount = 0;
}
......@@ -5605,7 +5607,7 @@ static int init_affinity_domains_orig(struct affinity_domain *ad)
err:
for (j = 0; j < i; j++) {
kfree(ad->domains_orig[j]);
ad->domains_orig[i] = NULL;
ad->domains_orig[j] = NULL;
}
return -ENOMEM;
}
......@@ -5671,7 +5673,7 @@ int init_auto_affinity(struct task_group *tg)
struct auto_affinity *auto_affi;
int ret;
auto_affi = kmalloc(sizeof(*auto_affi), GFP_KERNEL);
auto_affi = kzalloc(sizeof(*auto_affi), GFP_KERNEL);
if (!auto_affi)
return -ENOMEM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册