Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63eaa75e authored by Maurizio Lombardi's avatar Maurizio Lombardi Committed by Joerg Roedel
Browse files

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: default avatarMaurizio Lombardi <mlombard@redhat.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent cafd2545
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1393,6 +1393,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;