Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1549721 > unrolled thread

[v1] vfio: pci: vfio_pci:- Handle error from pci_iomap

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-01-03 13:00 +0100
Last post2017-01-03 13:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [v1] vfio: pci: vfio_pci:- Handle error from pci_iomap Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-01-03 13:00 +0100

#1549721 — [v1] vfio: pci: vfio_pci:- Handle error from pci_iomap

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-01-03 13:00 +0100
Subject[v1] vfio: pci: vfio_pci:- Handle error from pci_iomap
Message-ID<sVvUZ-5CH-19@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web