Thread (30 messages) 30 messages, 6 authors, 2015-02-25
STALE4130d
Revisions (3)
  1. v5 [diff vs current]
  2. v6 current
  3. v8 [diff vs current]

[PATCH v6 7/7] arm: dma-mapping: limit iommu mapping size

From: Murali Karicheri <hidden>
Date: 2015-02-05 21:55:26
Also in: linux-arm-kernel, linux-iommu, linux-pci, lkml
Subsystem: arm port, the rest · Maintainers: Russell King, Linus Torvalds

arm_iommu_create_mapping() has size parameter of size_t and
arm_setup_iommu_dma_ops() can take a value higher than that
when this is called from the of code. So limit the size to
SIZE_MAX.

Cc: Joerg Roedel <redacted>
Cc: Grant Likely <redacted>
Cc: Rob Herring <redacted>
Cc: Bjorn Helgaas <redacted>
Cc: Will Deacon <redacted>
Cc: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Cc: Arnd Bergmann <redacted>
Cc: Suravee Suthikulpanit <redacted>

Signed-off-by: Murali Karicheri <redacted>
---
 arch/arm/mm/dma-mapping.c |    7 +++++++
 1 file changed, 7 insertions(+)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index a673c7f..b05d907 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2027,6 +2027,13 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size,
 	if (!iommu)
 		return false;
 
+	/*
+	 * currently arm_iommu_create_mapping() takes a max of size_t
+	 * for size param. So check this limit for now.
+	 */
+	if (size > SIZE_MAX)
+		return false;
+
 	mapping = arm_iommu_create_mapping(dev->bus, dma_base, size);
 	if (IS_ERR(mapping)) {
 		pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n",
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help