summaryrefslogtreecommitdiffstats
path: root/drivers/vfio/pci
diff options
context:
space:
mode:
authorArvind Yadav <arvind.yadav.cs@gmail.com>2017-01-03 17:26:46 +0530
committerAlex Williamson <alex.williamson@redhat.com>2017-01-04 08:34:39 -0700
commite19f32da5ded958238eac1bbe001192acef191a2 (patch)
treeb80aac9fe6e190097ea965a1bdbd1855c88f8367 /drivers/vfio/pci
parentd293dbaa540b5800817cc10832d764b17cc211b5 (diff)
downloadblackbird-obmc-linux-e19f32da5ded958238eac1bbe001192acef191a2.tar.gz
blackbird-obmc-linux-e19f32da5ded958238eac1bbe001192acef191a2.zip
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/vfio/pci')
-rw-r--r--drivers/vfio/pci/vfio_pci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index dcd7c2a99618..324c52e3a1a4 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;
OpenPOWER on IntegriCloud