summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorGreg Kurz <groug@kaod.org>2019-04-19 18:37:17 +0300
committerAlex Williamson <alex.williamson@redhat.com>2019-05-01 22:31:41 +0300
commit2c85f2bd519457073444ec28bbb4743a4e4237a7 (patch)
tree3e3255c98bdb2a58a48decdac270d3a708a6e228 /drivers/vfio
parent41be3e2618174fdf3361e49e64f2bf530f40c6b0 (diff)
downloadlinux-2c85f2bd519457073444ec28bbb4743a4e4237a7.tar.xz
vfio-pci/nvlink2: Fix potential VMA leak
If vfio_pci_register_dev_region() fails then we should rollback previous changes, ie. unmap the ATSD registers. Fixes: 7f92891778df ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver") Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/pci/vfio_pci_nvlink2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
index 32f695ffe128..50fe3c4f7feb 100644
--- a/drivers/vfio/pci/vfio_pci_nvlink2.c
+++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
@@ -472,6 +472,8 @@ int vfio_pci_ibm_npu2_init(struct vfio_pci_device *vdev)
return 0;
free_exit:
+ if (data->base)
+ memunmap(data->base);
kfree(data);
return ret;