Skip to content

Commit 3fa6456

Browse files
l3b2w1Christoph Hellwig
authored andcommitted
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>
1 parent bf29bfa commit 3fa6456

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/dma/contiguous.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,11 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
473473
return -EBUSY;
474474
}
475475

476+
if (memblock_is_region_reserved(rmem->base, rmem->size)) {
477+
pr_info("Reserved memory: overlap with other memblock reserved region\n");
478+
return -EBUSY;
479+
}
480+
476481
if (!of_get_flat_dt_prop(node, "reusable", NULL) ||
477482
of_get_flat_dt_prop(node, "no-map", NULL))
478483
return -EINVAL;

0 commit comments

Comments
 (0)