提交 63eaa75e 编写于 作者: M Maurizio Lombardi 提交者: Joerg Roedel

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: NMaurizio Lombardi <mlombard@redhat.com>
Signed-off-by: NJoerg Roedel <jroedel@suse.de>
上级 cafd2545
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册