Skip to content

Commit dc48ebe

Browse files
ArvindYadavCsgregkh
authored andcommitted
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9379423 commit dc48ebe

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/vfio/pci/vfio_pci.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
902902
return ret;
903903

904904
vdev->barmap[index] = pci_iomap(pdev, index, 0);
905+
if (!vdev->barmap[index]) {
906+
pci_release_selected_regions(pdev, 1 << index);
907+
return -ENOMEM;
908+
}
905909
}
906910

907911
vma->vm_private_data = vdev;

0 commit comments

Comments
 (0)