diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2015-06-05 02:35:02 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-06-11 01:14:56 -0400 |
commit | 3c56e822f8fb0105949d04bda0e549e9d08713cd (patch) | |
tree | 61ec37ee7a4e0bf512a50547dd59e86188a03308 /drivers/vfio | |
parent | 2d270df8f71a0fded9ef01cb9282b46fd3bc0986 (diff) |
vfio: powerpc/spapr: Disable DMA mappings on disabled container
At the moment DMA map/unmap requests are handled irrespective to
the container's state. This allows the user space to pin memory which
it might not be allowed to pin.
This adds checks to MAP/UNMAP that the container is enabled, otherwise
-EPERM is returned.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
[aw: for the vfio related changes]
Acked-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/vfio_iommu_spapr_tce.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index 6e2e15fdb0df..5bbdf378fd59 100644 --- a/drivers/vfio/vfio_iommu_spapr_tce.c +++ b/drivers/vfio/vfio_iommu_spapr_tce.c | |||
@@ -318,6 +318,9 @@ static long tce_iommu_ioctl(void *iommu_data, | |||
318 | struct iommu_table *tbl = container->tbl; | 318 | struct iommu_table *tbl = container->tbl; |
319 | unsigned long tce; | 319 | unsigned long tce; |
320 | 320 | ||
321 | if (!container->enabled) | ||
322 | return -EPERM; | ||
323 | |||
321 | if (!tbl) | 324 | if (!tbl) |
322 | return -ENXIO; | 325 | return -ENXIO; |
323 | 326 | ||
@@ -362,6 +365,9 @@ static long tce_iommu_ioctl(void *iommu_data, | |||
362 | struct vfio_iommu_type1_dma_unmap param; | 365 | struct vfio_iommu_type1_dma_unmap param; |
363 | struct iommu_table *tbl = container->tbl; | 366 | struct iommu_table *tbl = container->tbl; |
364 | 367 | ||
368 | if (!container->enabled) | ||
369 | return -EPERM; | ||
370 | |||
365 | if (WARN_ON(!tbl)) | 371 | if (WARN_ON(!tbl)) |
366 | return -ENXIO; | 372 | return -ENXIO; |
367 | 373 | ||