[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <75592c19-309f-2626-68c9-1e74232be28e@linux.intel.com>
Date: Fri, 20 Mar 2020 21:49:17 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Jacob Pan <jacob.jun.pan@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
iommu@...ts.linux-foundation.org, Joerg Roedel <joro@...tes.org>,
David Woodhouse <dwmw2@...radead.org>
Cc: baolu.lu@...ux.intel.com, Raj Ashok <ashok.raj@...el.com>,
Yi Liu <yi.l.liu@...el.com>
Subject: Re: [PATCH 2/3] iommu/vt-d: Fix mm reference leak
On 2020/3/20 12:32, Jacob Pan wrote:
> Move canonical address check before mmget_not_zero() to avoid mm
> reference leak.
>
> Fixes: 9d8c3af31607 ("iommu/vt-d: IOMMU Page Request needs to check if
> address is canonical.")
>
> Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com>
Acked-by: Lu Baolu <baolu.lu@...ux.intel.com>
Best regards,
baolu
> ---
> drivers/iommu/intel-svm.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> index 1483f1845762..56253c59ca10 100644
> --- a/drivers/iommu/intel-svm.c
> +++ b/drivers/iommu/intel-svm.c
> @@ -861,14 +861,15 @@ static irqreturn_t prq_event_thread(int irq, void *d)
> * any faults on kernel addresses. */
> if (!svm->mm)
> goto bad_req;
> - /* If the mm is already defunct, don't handle faults. */
> - if (!mmget_not_zero(svm->mm))
> - goto bad_req;
>
> /* If address is not canonical, return invalid response */
> if (!is_canonical_address(address))
> goto bad_req;
>
> + /* If the mm is already defunct, don't handle faults. */
> + if (!mmget_not_zero(svm->mm))
> + goto bad_req;
> +
> down_read(&svm->mm->mmap_sem);
> vma = find_extend_vma(svm->mm, address);
> if (!vma || address < vma->vm_start)
>
Powered by blists - more mailing lists