]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iommu/riscv: prevent NULL deref in iova_to_phys
authorXianLiang Huang <huangxianliang@lanxincomputing.com>
Wed, 20 Aug 2025 07:22:48 +0000 (15:22 +0800)
committerJoerg Roedel <joerg.roedel@amd.com>
Fri, 22 Aug 2025 06:51:49 +0000 (08:51 +0200)
commit99d4d1a070870aa08163af8ce0522992b7f35d8c
tree6e0827cf83a748d88bd339bc673a32b33de4af66
parent72b6f7cd89cea8251979b65528d302f9c0ed37bf
iommu/riscv: prevent NULL deref in iova_to_phys

The riscv_iommu_pte_fetch() function returns either NULL for
unmapped/never-mapped iova, or a valid leaf pte pointer that
requires no further validation.

riscv_iommu_iova_to_phys() failed to handle NULL returns.
Prevent null pointer dereference in
riscv_iommu_iova_to_phys(), and remove the pte validation.

Fixes: 488ffbf18171 ("iommu/riscv: Paging domain support")
Cc: Tomasz Jeznach <tjeznach@rivosinc.com>
Signed-off-by: XianLiang Huang <huangxianliang@lanxincomputing.com>
Link: https://lore.kernel.org/r/20250820072248.312-1-huangxianliang@lanxincomputing.com
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
drivers/iommu/riscv/iommu.c