diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-01-03 17:26:46 +0530 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2017-01-04 08:34:39 -0700 |
commit | e19f32da5ded958238eac1bbe001192acef191a2 (patch) | |
tree | b80aac9fe6e190097ea965a1bdbd1855c88f8367 /drivers | |
parent | d293dbaa540b5800817cc10832d764b17cc211b5 (diff) | |
download | op-kernel-dev-e19f32da5ded958238eac1bbe001192acef191a2.zip op-kernel-dev-e19f32da5ded958238eac1bbe001192acef191a2.tar.gz |
vfio-pci: Handle error from pci_iomap
Here, pci_iomap can fail, handle this case release selected
pci regions and return -ENOMEM.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index dcd7c2a..324c52e 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -1142,6 +1142,10 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma) return ret; vdev->barmap[index] = pci_iomap(pdev, index, 0); + if (!vdev->barmap[index]) { + pci_release_selected_regions(pdev, 1 << index); + return -ENOMEM; + } } vma->vm_private_data = vdev; |