summaryrefslogtreecommitdiffstats
path: root/kernel/dma
diff options
context:
space:
mode:
authorBinglei Wang <l3b2w1@gmail.com>2023-07-26 16:28:23 +0200
committerChristoph Hellwig <hch@lst.de>2023-07-31 17:54:56 +0200
commit3fa6456ebe13adab3ba1817c8e515a5b88f95dce (patch)
treea2b937a3c5bd1fce9156f5bb1af83d42f7c0cec7 /kernel/dma
parentdma-contiguous: support numa CMA for specified node (diff)
downloadlinux-3fa6456ebe13adab3ba1817c8e515a5b88f95dce.tar.xz
linux-3fa6456ebe13adab3ba1817c8e515a5b88f95dce.zip
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: Binglei Wang <l3b2w1@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma')
-rw-r--r--kernel/dma/contiguous.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index f005c66f378c..88c595e49e34 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -473,6 +473,11 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
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) ||
of_get_flat_dt_prop(node, "no-map", NULL))
return -EINVAL;