]> git.baikalelectronics.ru Git - kernel.git/commit
iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure
authorYunfei Wang <yf.wang@mediatek.com>
Tue, 7 Dec 2021 11:33:15 +0000 (19:33 +0800)
committerWill Deacon <will@kernel.org>
Tue, 14 Dec 2021 14:45:35 +0000 (14:45 +0000)
commitc22979f2bf993d9490d5302b65464689bfae2555
tree96d7f0c7f4bff0ceb31a0ff3b3f432b7a025f574
parent28bcae0de93f1649ac863cf8ddc6ff213c9fd982
iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure

In __arm_v7s_alloc_table function:
iommu call kmem_cache_alloc to allocate page table, this function
allocate memory may fail, when kmem_cache_alloc fails to allocate
table, call virt_to_phys will be abnomal and return unexpected phys
and goto out_free, then call kmem_cache_free to release table will
trigger KE, __get_free_pages and free_pages have similar problem,
so add error handle for page table allocation failure.

Fixes: 12f43e7c4d23 ("iommu/io-pgtable-arm-v7s: Abort allocation when table address overflows the PTE")
Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
Cc: <stable@vger.kernel.org> # 5.10.*
Acked-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20211207113315.29109-1-yf.wang@mediatek.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/iommu/io-pgtable-arm-v7s.c