Commit 8846af75 authored by Linus Torvalds's avatar Linus Torvalds

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
parents a92c9ab6 4752354a
...@@ -860,6 +860,11 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, ...@@ -860,6 +860,11 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data,
if (ret) if (ret)
goto pin_unwind; goto pin_unwind;
if (!pfn_valid(phys_pfn)) {
ret = -EINVAL;
goto pin_unwind;
}
ret = vfio_add_to_pfn_list(dma, iova, phys_pfn); ret = vfio_add_to_pfn_list(dma, iova, phys_pfn);
if (ret) { if (ret) {
if (put_pfn(phys_pfn, dma->prot) && do_accounting) if (put_pfn(phys_pfn, dma->prot) && do_accounting)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment