From: Kirill A. Shutemov Date: Thu, 14 Nov 2013 22:31:49 +0000 (-0800) Subject: iommu/arm-smmu: handle pgtable_page_ctor() fail X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=01058e70767de7b846588ef651c4d66e862f6823;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git iommu/arm-smmu: handle pgtable_page_ctor() fail Signed-off-by: Kirill A. Shutemov Acked-by: Will Deacon Cc: Grant Likely Cc: Rob Herring Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 181c9ba929cd..2349d6272aef 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1212,7 +1212,10 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, arm_smmu_flush_pgtable(smmu, page_address(table), ARM_SMMU_PTE_HWTABLE_SIZE); - pgtable_page_ctor(table); + if (!pgtable_page_ctor(table)) { + __free_page(table); + return -ENOMEM; + } pmd_populate(NULL, pmd, table); arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); }