diff options
author | Maurizio Lombardi <mlombard@redhat.com> | 2014-09-11 06:28:03 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-09-25 09:58:42 -0400 |
commit | 63eaa75e4362ac7981a7e619196a9c75fd03d717 (patch) | |
tree | 59c26138350670efae84d3bd5dae773a543a01bf /drivers/iommu | |
parent | cafd2545cfd36ef6fee14f9c36870b81d3c98de5 (diff) |
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.
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/amd_iommu.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 989c1ae03979..23c5be6a3a1e 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -1393,6 +1393,9 @@ static int iommu_map_page(struct protection_domain *dom, | |||
1393 | count = PAGE_SIZE_PTE_COUNT(page_size); | 1393 | count = PAGE_SIZE_PTE_COUNT(page_size); |
1394 | pte = alloc_pte(dom, bus_addr, page_size, NULL, GFP_KERNEL); | 1394 | pte = alloc_pte(dom, bus_addr, page_size, NULL, GFP_KERNEL); |
1395 | 1395 | ||
1396 | if (!pte) | ||
1397 | return -ENOMEM; | ||
1398 | |||
1396 | for (i = 0; i < count; ++i) | 1399 | for (i = 0; i < count; ++i) |
1397 | if (IOMMU_PTE_PRESENT(pte[i])) | 1400 | if (IOMMU_PTE_PRESENT(pte[i])) |
1398 | return -EBUSY; | 1401 | return -EBUSY; |