All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-10-19  0:39 ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-10-19  0:39 UTC (permalink / raw)
  To: joro, dwmw2; +Cc: ashok.raj, jacob.jun.pan, iommu, linux-kernel, Lu Baolu

intel_svm_alloc_pasid_tables() might return an error but never be
checked by the callers. Later when intel_svm_bind_mm() is called,
there are no checks for valid pasid tables before enabling them.

Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel-svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index f6697e5..43280ca 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
 	int pasid_max;
 	int ret;
 
-	if (WARN_ON(!iommu))
+	if (WARN_ON(!iommu || !iommu->pasid_table))
 		return -EINVAL;
 
 	if (dev_is_pci(dev)) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-10-19  0:39 ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-10-19  0:39 UTC (permalink / raw)
  To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

intel_svm_alloc_pasid_tables() might return an error but never be
checked by the callers. Later when intel_svm_bind_mm() is called,
there are no checks for valid pasid tables before enabling them.

Signed-off-by: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/iommu/intel-svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index f6697e5..43280ca 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
 	int pasid_max;
 	int ret;
 
-	if (WARN_ON(!iommu))
+	if (WARN_ON(!iommu || !iommu->pasid_table))
 		return -EINVAL;
 
 	if (dev_is_pci(dev)) {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/3] iommu/vt-d: Clear Page Request Overflow fault bit
  2017-10-19  0:39 ` Lu Baolu
  (?)
@ 2017-10-19  0:39 ` Lu Baolu
  -1 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-10-19  0:39 UTC (permalink / raw)
  To: joro, dwmw2; +Cc: ashok.raj, jacob.jun.pan, iommu, linux-kernel, Lu Baolu

Currently Page Request Overflow bit in IOMMU Fault Status register
is not cleared. Not clearing this bit would mean that any  future
page-request is going to be automatically dropped by IOMMU.

Suggested-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/dmar.c        | 3 ++-
 include/linux/intel-iommu.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 1ea7cd5..9a7ffd1 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1679,7 +1679,8 @@ irqreturn_t dmar_fault(int irq, void *dev_id)
 		raw_spin_lock_irqsave(&iommu->register_lock, flag);
 	}
 
-	writel(DMA_FSTS_PFO | DMA_FSTS_PPF, iommu->reg + DMAR_FSTS_REG);
+	writel(DMA_FSTS_PFO | DMA_FSTS_PPF | DMA_FSTS_PRO,
+	       iommu->reg + DMAR_FSTS_REG);
 
 unlock_exit:
 	raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 485a5b4..f3274d9 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -212,6 +212,7 @@
 #define DMA_FSTS_IQE (1 << 4)
 #define DMA_FSTS_ICE (1 << 5)
 #define DMA_FSTS_ITE (1 << 6)
+#define DMA_FSTS_PRO (1 << 7)
 #define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
 
 /* FRCD_REG, 32 bits access */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/3] iommu/vt-d: Clear pasid table entry when memory unbound
  2017-10-19  0:39 ` Lu Baolu
  (?)
  (?)
@ 2017-10-19  0:39 ` Lu Baolu
  -1 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-10-19  0:39 UTC (permalink / raw)
  To: joro, dwmw2; +Cc: ashok.raj, jacob.jun.pan, iommu, linux-kernel, Lu Baolu

In intel_svm_unbind_mm(), pasid table entry must be cleared during
svm free. Otherwise, hardware may be set up with a wild pointer.

Suggested-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel-svm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index 43280ca..ed1cf7c 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -458,6 +458,8 @@ int intel_svm_unbind_mm(struct device *dev, int pasid)
 				kfree_rcu(sdev, rcu);
 
 				if (list_empty(&svm->devs)) {
+					svm->iommu->pasid_table[svm->pasid].val = 0;
+					wmb();
 
 					idr_remove(&svm->iommu->pasid_idr, svm->pasid);
 					if (svm->mm)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation     fails
  2017-10-19  0:39 ` Lu Baolu
                   ` (2 preceding siblings ...)
  (?)
@ 2017-10-19  6:40 ` Liu, Yi L
  2017-10-20  0:48     ` Lu Baolu
  -1 siblings, 1 reply; 13+ messages in thread
From: Liu, Yi L @ 2017-10-19  6:40 UTC (permalink / raw)
  To: Lu Baolu, joro, dwmw2; +Cc: iommu, linux-kernel



> -----Original Message-----
> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> bounces@lists.linux-foundation.org] On Behalf Of Lu Baolu
> Sent: Thursday, October 19, 2017 8:39 AM
> To: joro@8bytes.org; dwmw2@infradead.org
> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> Subject: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
> 
> intel_svm_alloc_pasid_tables() might return an error but never be checked by the
> callers. Later when intel_svm_bind_mm() is called, there are no checks for valid pasid
> tables before enabling them.
> 
> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
>  drivers/iommu/intel-svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index
> f6697e5..43280ca 100644
> --- a/drivers/iommu/intel-svm.c
> +++ b/drivers/iommu/intel-svm.c
> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int
> flags, struct svm_dev_
>  	int pasid_max;
>  	int ret;
> 
> -	if (WARN_ON(!iommu))
> +	if (WARN_ON(!iommu || !iommu->pasid_table))

[Liu, Yi L] Hi Baolu, I guess there also need a check to iommu->ecap , see if the pasid bit
is reported. thoughts?

Regards,
Yi L

>  		return -EINVAL;
> 
>  	if (dev_is_pci(dev)) {
> --
> 2.7.4
> 
> _______________________________________________
> iommu mailing list
> iommu@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-10-20  0:48     ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-10-20  0:48 UTC (permalink / raw)
  To: Liu, Yi L, joro, dwmw2; +Cc: iommu, linux-kernel

Hi Yi,

On 10/19/2017 02:40 PM, Liu, Yi L wrote:
>
>> -----Original Message-----
>> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
>> bounces@lists.linux-foundation.org] On Behalf Of Lu Baolu
>> Sent: Thursday, October 19, 2017 8:39 AM
>> To: joro@8bytes.org; dwmw2@infradead.org
>> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
>> Subject: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
>>
>> intel_svm_alloc_pasid_tables() might return an error but never be checked by the
>> callers. Later when intel_svm_bind_mm() is called, there are no checks for valid pasid
>> tables before enabling them.
>>
>> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>>  drivers/iommu/intel-svm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index
>> f6697e5..43280ca 100644
>> --- a/drivers/iommu/intel-svm.c
>> +++ b/drivers/iommu/intel-svm.c
>> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int
>> flags, struct svm_dev_
>>  	int pasid_max;
>>  	int ret;
>>
>> -	if (WARN_ON(!iommu))
>> +	if (WARN_ON(!iommu || !iommu->pasid_table))
> [Liu, Yi L] Hi Baolu, I guess there also need a check to iommu->ecap , see if the pasid bit
> is reported. thoughts?
>

If pasid bit is not set in ecap register, iommu->pasid_table won't be set.

We did this by:

                if (pasid_enabled(iommu))
                        intel_svm_alloc_pasid_tables(iommu);

Best regards,
Lu Baolu

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-10-20  0:48     ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-10-20  0:48 UTC (permalink / raw)
  To: Liu, Yi L, joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Hi Yi,

On 10/19/2017 02:40 PM, Liu, Yi L wrote:
>
>> -----Original Message-----
>> From: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org [mailto:iommu-
>> bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org] On Behalf Of Lu Baolu
>> Sent: Thursday, October 19, 2017 8:39 AM
>> To: joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org; dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
>> Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> Subject: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
>>
>> intel_svm_alloc_pasid_tables() might return an error but never be checked by the
>> callers. Later when intel_svm_bind_mm() is called, there are no checks for valid pasid
>> tables before enabling them.
>>
>> Signed-off-by: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> ---
>>  drivers/iommu/intel-svm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c index
>> f6697e5..43280ca 100644
>> --- a/drivers/iommu/intel-svm.c
>> +++ b/drivers/iommu/intel-svm.c
>> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int
>> flags, struct svm_dev_
>>  	int pasid_max;
>>  	int ret;
>>
>> -	if (WARN_ON(!iommu))
>> +	if (WARN_ON(!iommu || !iommu->pasid_table))
> [Liu, Yi L] Hi Baolu, I guess there also need a check to iommu->ecap , see if the pasid bit
> is reported. thoughts?
>

If pasid bit is not set in ecap register, iommu->pasid_table won't be set.

We did this by:

                if (pasid_enabled(iommu))
                        intel_svm_alloc_pasid_tables(iommu);

Best regards,
Lu Baolu

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-10-20  6:32       ` Liu, Yi L
  0 siblings, 0 replies; 13+ messages in thread
From: Liu, Yi L @ 2017-10-20  6:32 UTC (permalink / raw)
  To: Lu Baolu, joro, dwmw2; +Cc: iommu, linux-kernel



> -----Original Message-----
> From: Lu Baolu [mailto:baolu.lu@linux.intel.com]
> Sent: Friday, October 20, 2017 8:49 AM
> To: Liu, Yi L <yi.l.liu@intel.com>; joro@8bytes.org; dwmw2@infradead.org
> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation
> fails
> 
> Hi Yi,
> 
> On 10/19/2017 02:40 PM, Liu, Yi L wrote:
> >
> >> -----Original Message-----
> >> From: iommu-bounces@lists.linux-foundation.org [mailto:iommu-
> >> bounces@lists.linux-foundation.org] On Behalf Of Lu Baolu
> >> Sent: Thursday, October 19, 2017 8:39 AM
> >> To: joro@8bytes.org; dwmw2@infradead.org
> >> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> >> Subject: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if
> >> allocation fails
> >>
> >> intel_svm_alloc_pasid_tables() might return an error but never be
> >> checked by the callers. Later when intel_svm_bind_mm() is called,
> >> there are no checks for valid pasid tables before enabling them.
> >>
> >> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
> >> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> >> ---
> >>  drivers/iommu/intel-svm.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> >> index f6697e5..43280ca 100644
> >> --- a/drivers/iommu/intel-svm.c
> >> +++ b/drivers/iommu/intel-svm.c
> >> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int
> >> *pasid, int flags, struct svm_dev_
> >>  	int pasid_max;
> >>  	int ret;
> >>
> >> -	if (WARN_ON(!iommu))
> >> +	if (WARN_ON(!iommu || !iommu->pasid_table))
> > [Liu, Yi L] Hi Baolu, I guess there also need a check to iommu->ecap ,
> > see if the pasid bit is reported. thoughts?
> >
> 
> If pasid bit is not set in ecap register, iommu->pasid_table won't be set.
> 
> We did this by:
> 
>                 if (pasid_enabled(iommu))
>                         intel_svm_alloc_pasid_tables(iommu);

[Liu, Yi L] Sounds good. thx.

Reviewed-by: Liu, Yi L <yi.l.liu@intel.com>

Regards,
Yi L

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-10-20  6:32       ` Liu, Yi L
  0 siblings, 0 replies; 13+ messages in thread
From: Liu, Yi L @ 2017-10-20  6:32 UTC (permalink / raw)
  To: Lu Baolu, joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ
  Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA



> -----Original Message-----
> From: Lu Baolu [mailto:baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org]
> Sent: Friday, October 20, 2017 8:49 AM
> To: Liu, Yi L <yi.l.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>; joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org; dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
> Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation
> fails
> 
> Hi Yi,
> 
> On 10/19/2017 02:40 PM, Liu, Yi L wrote:
> >
> >> -----Original Message-----
> >> From: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org [mailto:iommu-
> >> bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org] On Behalf Of Lu Baolu
> >> Sent: Thursday, October 19, 2017 8:39 AM
> >> To: joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org; dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
> >> Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >> Subject: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if
> >> allocation fails
> >>
> >> intel_svm_alloc_pasid_tables() might return an error but never be
> >> checked by the callers. Later when intel_svm_bind_mm() is called,
> >> there are no checks for valid pasid tables before enabling them.
> >>
> >> Signed-off-by: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> >> Signed-off-by: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> >> ---
> >>  drivers/iommu/intel-svm.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> >> index f6697e5..43280ca 100644
> >> --- a/drivers/iommu/intel-svm.c
> >> +++ b/drivers/iommu/intel-svm.c
> >> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int
> >> *pasid, int flags, struct svm_dev_
> >>  	int pasid_max;
> >>  	int ret;
> >>
> >> -	if (WARN_ON(!iommu))
> >> +	if (WARN_ON(!iommu || !iommu->pasid_table))
> > [Liu, Yi L] Hi Baolu, I guess there also need a check to iommu->ecap ,
> > see if the pasid bit is reported. thoughts?
> >
> 
> If pasid bit is not set in ecap register, iommu->pasid_table won't be set.
> 
> We did this by:
> 
>                 if (pasid_enabled(iommu))
>                         intel_svm_alloc_pasid_tables(iommu);

[Liu, Yi L] Sounds good. thx.

Reviewed-by: Liu, Yi L <yi.l.liu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Regards,
Yi L

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-11-06 20:13   ` Alex Williamson
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Williamson @ 2017-11-06 20:13 UTC (permalink / raw)
  To: Lu Baolu; +Cc: joro, dwmw2, iommu, linux-kernel

On Thu, 19 Oct 2017 08:39:14 +0800
Lu Baolu <baolu.lu@linux.intel.com> wrote:

> intel_svm_alloc_pasid_tables() might return an error but never be
> checked by the callers. Later when intel_svm_bind_mm() is called,
> there are no checks for valid pasid tables before enabling them.
> 
> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
>  drivers/iommu/intel-svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> index f6697e5..43280ca 100644
> --- a/drivers/iommu/intel-svm.c
> +++ b/drivers/iommu/intel-svm.c
> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
>  	int pasid_max;
>  	int ret;
>  
> -	if (WARN_ON(!iommu))
> +	if (WARN_ON(!iommu || !iommu->pasid_table))
>  		return -EINVAL;
>  
>  	if (dev_is_pci(dev)) {

Applied series to iommu/vt-d for v4.15.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-11-06 20:13   ` Alex Williamson
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Williamson @ 2017-11-06 20:13 UTC (permalink / raw)
  To: Lu Baolu
  Cc: dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Thu, 19 Oct 2017 08:39:14 +0800
Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:

> intel_svm_alloc_pasid_tables() might return an error but never be
> checked by the callers. Later when intel_svm_bind_mm() is called,
> there are no checks for valid pasid tables before enabling them.
> 
> Signed-off-by: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> ---
>  drivers/iommu/intel-svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> index f6697e5..43280ca 100644
> --- a/drivers/iommu/intel-svm.c
> +++ b/drivers/iommu/intel-svm.c
> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
>  	int pasid_max;
>  	int ret;
>  
> -	if (WARN_ON(!iommu))
> +	if (WARN_ON(!iommu || !iommu->pasid_table))
>  		return -EINVAL;
>  
>  	if (dev_is_pci(dev)) {

Applied series to iommu/vt-d for v4.15.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-11-07  2:57     ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-11-07  2:57 UTC (permalink / raw)
  To: Alex Williamson; +Cc: joro, dwmw2, iommu, linux-kernel

Hi,

On 11/07/2017 04:13 AM, Alex Williamson wrote:
> On Thu, 19 Oct 2017 08:39:14 +0800
> Lu Baolu <baolu.lu@linux.intel.com> wrote:
>
>> intel_svm_alloc_pasid_tables() might return an error but never be
>> checked by the callers. Later when intel_svm_bind_mm() is called,
>> there are no checks for valid pasid tables before enabling them.
>>
>> Signed-off-by: Ashok Raj <ashok.raj@intel.com>
>> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
>> ---
>>  drivers/iommu/intel-svm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
>> index f6697e5..43280ca 100644
>> --- a/drivers/iommu/intel-svm.c
>> +++ b/drivers/iommu/intel-svm.c
>> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
>>  	int pasid_max;
>>  	int ret;
>>  
>> -	if (WARN_ON(!iommu))
>> +	if (WARN_ON(!iommu || !iommu->pasid_table))
>>  		return -EINVAL;
>>  
>>  	if (dev_is_pci(dev)) {
> Applied series to iommu/vt-d for v4.15.  Thanks,
>
> Alex
>

Thank you, Alex.

Best regards,
Lu Baolu

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails
@ 2017-11-07  2:57     ` Lu Baolu
  0 siblings, 0 replies; 13+ messages in thread
From: Lu Baolu @ 2017-11-07  2:57 UTC (permalink / raw)
  To: Alex Williamson
  Cc: dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Hi,

On 11/07/2017 04:13 AM, Alex Williamson wrote:
> On Thu, 19 Oct 2017 08:39:14 +0800
> Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org> wrote:
>
>> intel_svm_alloc_pasid_tables() might return an error but never be
>> checked by the callers. Later when intel_svm_bind_mm() is called,
>> there are no checks for valid pasid tables before enabling them.
>>
>> Signed-off-by: Ashok Raj <ashok.raj-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>> Signed-off-by: Lu Baolu <baolu.lu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>> ---
>>  drivers/iommu/intel-svm.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
>> index f6697e5..43280ca 100644
>> --- a/drivers/iommu/intel-svm.c
>> +++ b/drivers/iommu/intel-svm.c
>> @@ -292,7 +292,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
>>  	int pasid_max;
>>  	int ret;
>>  
>> -	if (WARN_ON(!iommu))
>> +	if (WARN_ON(!iommu || !iommu->pasid_table))
>>  		return -EINVAL;
>>  
>>  	if (dev_is_pci(dev)) {
> Applied series to iommu/vt-d for v4.15.  Thanks,
>
> Alex
>

Thank you, Alex.

Best regards,
Lu Baolu

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-11-07  2:57 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-19  0:39 [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails Lu Baolu
2017-10-19  0:39 ` Lu Baolu
2017-10-19  0:39 ` [PATCH 2/3] iommu/vt-d: Clear Page Request Overflow fault bit Lu Baolu
2017-10-19  0:39 ` [PATCH 3/3] iommu/vt-d: Clear pasid table entry when memory unbound Lu Baolu
2017-10-19  6:40 ` [PATCH 1/3] iommu/vt-d: Missing checks for pasid tables if allocation fails Liu, Yi L
2017-10-20  0:48   ` Lu Baolu
2017-10-20  0:48     ` Lu Baolu
2017-10-20  6:32     ` Liu, Yi L
2017-10-20  6:32       ` Liu, Yi L
2017-11-06 20:13 ` Alex Williamson
2017-11-06 20:13   ` Alex Williamson
2017-11-07  2:57   ` Lu Baolu
2017-11-07  2:57     ` Lu Baolu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.