Skip to contentSkip to conversation

amd_iommu: do not dereference a NULL pointer address.

PATCH Applied Maurizio Lombardi 2 participants 2 messages Sep 11, 2014 – Sep 25, 2014 1 message not in the archive IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amd_iommu: do not dereference a NULL pointer address.

under low memory conditions, alloc_pte() may return a NULL pointer. iommu_map_page() does not check it and will panic the system.

---
 drivers/iommu/amd_iommu.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/iommu/amd_iommu.c +3 -0
index ecb0109..9585268 100644
@@ -1368,6 +1368,9 @@ static int iommu_map_page(struct protection_domain *dom,
 	count     = PAGE_SIZE_PTE_COUNT(page_size);
 	pte       = alloc_pte(dom, bus_addr, page_size, NULL, GFP_KERNEL);
 
+	if (!pte)
+		return -ENOMEM;
+
 	for (i = 0; i < count; ++i)
 		if (IOMMU_PTE_PRESENT(pte[i]))
 			return -EBUSY;
Signature · 1 line
Maurizio Lombardi

A message that is not in the archive (sent off-list or not yet received): 1410431283-21417-1-git-send-email-mlombard-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

Applied
#2 lore raw
Quoted 7 lines · Maurizio Lombardi

under low memory conditions, alloc_pte() may return a NULL pointer. iommu_map_page() does not check it and will panic the system.

---
 drivers/iommu/amd_iommu.c | 3 +++
 1 file changed, 3 insertions(+)

Applied, thanks.