Skip to content

Commit 8846af7

Browse files
committed
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
2 parents a92c9ab + 4752354 commit 8846af7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/vfio/vfio_iommu_type1.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,11 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data,
860860
if (ret)
861861
goto pin_unwind;
862862

863+
if (!pfn_valid(phys_pfn)) {
864+
ret = -EINVAL;
865+
goto pin_unwind;
866+
}
867+
863868
ret = vfio_add_to_pfn_list(dma, iova, phys_pfn);
864869
if (ret) {
865870
if (put_pfn(phys_pfn, dma->prot) && do_accounting)

0 commit comments

Comments
 (0)