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>
This commit is contained in:
parent
93794239c6
commit
dc48ebe330
1 changed files with 4 additions and 0 deletions
|
@ -902,6 +902,10 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
vdev->barmap[index] = pci_iomap(pdev, index, 0);
|
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;
|
vma->vm_private_data = vdev;
|
||||||
|
|
Loading…
Add table
Reference in a new issue