提交 ad4a9b6f 编写于 作者: X Xie XiuQi

arm64/mpam: unmap all previous address when failed

hulk inclusion
category: bugfix
bugzilla: 14212
CVE: NA
Signed-off-by: NXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 310dfdff
...@@ -101,6 +101,21 @@ struct mpam_node mpam_node_all[] = { ...@@ -101,6 +101,21 @@ struct mpam_node mpam_node_all[] = {
MPAM_NODE(HHAALL3, MPAM_RESOURCE_MC, 0x200090ULL, 0xC1), MPAM_NODE(HHAALL3, MPAM_RESOURCE_MC, 0x200090ULL, 0xC1),
}; };
void mpam_nodes_unmap(void)
{
int i;
size_t num_nodes = ARRAY_SIZE(mpam_node_all);
struct mpam_node *n;
for (i = 0; i < num_nodes; i++) {
n = &mpam_node_all[i];
if (n->base) {
iounmap(n->base);
n->base = NULL;
}
}
}
int mpam_nodes_init(void) int mpam_nodes_init(void)
{ {
int i, ret = 0; int i, ret = 0;
...@@ -111,6 +126,10 @@ int mpam_nodes_init(void) ...@@ -111,6 +126,10 @@ int mpam_nodes_init(void)
n = &mpam_node_all[i]; n = &mpam_node_all[i];
ret |= cpulist_parse(n->cpus_list, &n->cpu_mask); ret |= cpulist_parse(n->cpus_list, &n->cpu_mask);
n->base = ioremap(n->addr, 0x10000); n->base = ioremap(n->addr, 0x10000);
if (!n->base) {
mpam_nodes_unmap();
return -ENOMEM;
}
} }
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册