Commit 3fa6456e authored by Binglei Wang's avatar Binglei Wang Committed by Christoph Hellwig

dma-contiguous: check for memory region overlap

In the process of parsing the DTS, check whether the memory region
specified by the DTS CMA node area overlaps with the kernel text
memory space reserved by memblock before calling
early_init_fdt_scan_reserved_mem.
Signed-off-by: default avatarBinglei Wang <l3b2w1@gmail.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent bf29bfaa
...@@ -473,6 +473,11 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) ...@@ -473,6 +473,11 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
return -EBUSY; return -EBUSY;
} }
if (memblock_is_region_reserved(rmem->base, rmem->size)) {
pr_info("Reserved memory: overlap with other memblock reserved region\n");
return -EBUSY;
}
if (!of_get_flat_dt_prop(node, "reusable", NULL) || if (!of_get_flat_dt_prop(node, "reusable", NULL) ||
of_get_flat_dt_prop(node, "no-map", NULL)) of_get_flat_dt_prop(node, "no-map", NULL))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment