]> git.baikalelectronics.ru Git - kernel.git/commit
vfio/spapr/nvlink2: Skip unpinning pages on error exit
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 23 Dec 2019 01:09:27 +0000 (12:09 +1100)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 6 Jan 2020 17:01:05 +0000 (10:01 -0700)
commitec3492be7c428a5ea474191c809655add08b70d7
treece0b588173984a2285d663c4f61c91ba085b103e
parentd4f46b330cc523efd6fb99dfb35e4def34bd935c
vfio/spapr/nvlink2: Skip unpinning pages on error exit

The nvlink2 subdriver for IBM Witherspoon machines preregisters
GPU memory in the IOMMI API so KVM TCE code can map this memory
for DMA as well. This is done by mm_iommu_newdev() called from
vfio_pci_nvgpu_regops::mmap.

In an unlikely event of failure the data->mem remains NULL and
since mm_iommu_put() (which unregisters the region and unpins memory
if that was regular memory) does not expect mem=NULL, it should not be
called.

This adds a check to only call mm_iommu_put() for a valid data->mem.

Fixes: fedfc7000876 ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_nvlink2.c