diff options
author | Arvind Yadav <arvind.yadav.cs@gmail.com> | 2017-01-03 17:26:46 +0530 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-09-10 16:35:56 -0400 |
commit | e341a32e1cb66701416f1a37c46873950be34928 (patch) | |
tree | ffa7de0603c1bf9adaf397da58e3866c8bb33896 /drivers | |
parent | 9de0a4e3ab8a8eaad4c40f3cb892778600fbf5f7 (diff) |
vfio-pci: Handle error from pci_iomap
[ Upstream commit e19f32da5ded958238eac1bbe001192acef191a2 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.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 ae90cf8867b5..f85e3a17cf5a 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -902,6 +902,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; |