]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 09:58:59 +0000 (10:58 +0100)
commitf1ce6a491c093615a0ef1a73c17aba5d262e1a45
tree15cb2a8f878e37791cd534e2225b42d2e2955423
parent83981fa1501f887478ac63e89bcc75af20a75117
iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure

BugLink: https://bugs.launchpad.net/bugs/1959376
commit a556cfe4cabc6d79cbb7733f118bbb420b376fe6 upstream.

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: 29859aeb8a6e ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/iommu/io-pgtable-arm-v7s.c