]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
vfio-pci/nvlink2: Fix potential VMA leak
authorGreg Kurz <groug@kaod.org>
Fri, 19 Apr 2019 15:37:17 +0000 (17:37 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 1 May 2019 19:31:41 +0000 (13:31 -0600)
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>
drivers/vfio/pci/vfio_pci_nvlink2.c

index 32f695ffe128085b0df8b8c0025e9b420868f6f8..50fe3c4f7feb64494fd028146d11c950ee11d8ec 100644 (file)
@@ -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;