Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1549721
| From | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [v1] vfio: pci: vfio_pci:- Handle error from pci_iomap |
| Date | 2017-01-03 13:00 +0100 |
| Message-ID | <sVvUZ-5CH-19@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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>
---
drivers/vfio/pci/vfio_pci.c | 4 ++++
1 file changed, 4 insertions(+)
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;
--
1.9.1
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[v1] vfio: pci: vfio_pci:- Handle error from pci_iomap Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-01-03 13:00 +0100
csiph-web