[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1483444606-16463-1-git-send-email-arvind.yadav.cs@gmail.com>
Date: Tue, 3 Jan 2017 17:26:46 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: alex.williamson@...hat.com
Cc: cjia@...dia.com, kwankhede@...dia.com, xyjxie@...ux.vnet.ibm.com,
mst@...hat.com, vlad@...rklevich.net, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [v1] vfio: pci: 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@...il.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
Powered by blists - more mailing lists