mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> [aw: for the vfio related changes] Acked-by: Alex Williamson <[email protected]> Reviewed-by: David Gibson <[email protected]> Reviewed-by: Gavin Shan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
This commit is contained in:
parent
2d270df8f7
commit
3c56e822f8
1 changed files with 6 additions and 0 deletions
|
|
@ -318,6 +318,9 @@ static long tce_iommu_ioctl(void *iommu_data,
|
|||
struct iommu_table *tbl = container->tbl;
|
||||
unsigned long tce;
|
||||
|
||||
if (!container->enabled)
|
||||
return -EPERM;
|
||||
|
||||
if (!tbl)
|
||||
return -ENXIO;
|
||||
|
||||
|
|
@ -362,6 +365,9 @@ static long tce_iommu_ioctl(void *iommu_data,
|
|||
struct vfio_iommu_type1_dma_unmap param;
|
||||
struct iommu_table *tbl = container->tbl;
|
||||
|
||||
if (!container->enabled)
|
||||
return -EPERM;
|
||||
|
||||
if (WARN_ON(!tbl))
|
||||
return -ENXIO;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue