[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150513062025.GA8256@gwshan>
Date: Wed, 13 May 2015 16:20:25 +1000
From: Gavin Shan <gwshan@...ux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@...abs.ru>
Cc: linuxppc-dev@...ts.ozlabs.org,
David Gibson <david@...son.dropbear.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Alex Williamson <alex.williamson@...hat.com>,
Gavin Shan <gwshan@...ux.vnet.ibm.com>,
Wei Yang <weiyang@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH kernel v10 10/34] vfio: powerpc/spapr: Disable DMA
mappings on disabled container
On Tue, May 12, 2015 at 01:38:59AM +1000, Alexey Kardashevskiy wrote:
>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@...abs.ru>
>[aw: for the vfio related changes]
>Acked-by: Alex Williamson <alex.williamson@...hat.com>
>Reviewed-by: David Gibson <david@...son.dropbear.id.au>
Reviewed-by: Gavin Shan <gwshan@...ux.vnet.ibm.com>
Thanks,
Gavin
>---
> drivers/vfio/vfio_iommu_spapr_tce.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
>diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c
>index 40583f9..e21479c 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,
> 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;
>
>--
>2.4.0.rc3.8.gfb3e7d5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists