aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-05-26 15:57:14 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-05-26 15:57:14 -0700
commit8846af7547b52704cc50b76eecb5fe5a5128fda9 (patch)
treed133c43032d7fa81eb845774631653a4cd614faa
parenta92c9ab69f6696b26ef0c1ca3e8b922d1fc82e86 (diff)
parent4752354af71043e6fd72ef5490ed6da39e6cab4a (diff)
downloadlinux-8846af7547b52704cc50b76eecb5fe5a5128fda9.tar.gz
Merge tag 'vfio-v6.4-rc4' of https://github.com/awilliam/linux-vfio
Pull VFIO fix from Alex Williamson: - Test for and return error for invalid pfns through the pin pages interface (Yan Zhao) * tag 'vfio-v6.4-rc4' of https://github.com/awilliam/linux-vfio: vfio/type1: check pfn valid before converting to struct page
-rw-r--r--drivers/vfio/vfio_iommu_type1.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 3d4dd9420c307..0d2f805468e19 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -860,6 +860,11 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data,
if (ret)
goto pin_unwind;
+ if (!pfn_valid(phys_pfn)) {
+ ret = -EINVAL;
+ goto pin_unwind;
+ }
+
ret = vfio_add_to_pfn_list(dma, iova, phys_pfn);
if (ret) {
if (put_pfn(phys_pfn, dma->prot) && do_accounting)