linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/vt-d: Fix a potential memory leak
@ 2018-02-24  5:42 Lu Baolu
  2018-02-28 15:10 ` Jacob Pan
  2018-03-15 14:16 ` Joerg Roedel
  0 siblings, 2 replies; 3+ messages in thread
From: Lu Baolu @ 2018-02-24  5:42 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: iommu, linux-kernel, Lu Baolu, Ashok Raj, Jacob Pan, # v4 . 4+

A memory block was allocated in intel_svm_bind_mm() but never freed
in a failure path. This patch fixes this by free it to avoid memory
leakage.

Cc: Ashok Raj <ashok.raj@intel.com>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: <stable@vger.kernel.org> # v4.4+
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 drivers/iommu/intel-svm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
index 35a408d..3d4b924 100644
--- a/drivers/iommu/intel-svm.c
+++ b/drivers/iommu/intel-svm.c
@@ -396,6 +396,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
 				pasid_max - 1, GFP_KERNEL);
 		if (ret < 0) {
 			kfree(svm);
+			kfree(sdev);
 			goto out;
 		}
 		svm->pasid = ret;
-- 
2.7.4

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

* Re: [PATCH 1/1] iommu/vt-d: Fix a potential memory leak
  2018-02-24  5:42 [PATCH 1/1] iommu/vt-d: Fix a potential memory leak Lu Baolu
@ 2018-02-28 15:10 ` Jacob Pan
  2018-03-15 14:16 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Jacob Pan @ 2018-02-28 15:10 UTC (permalink / raw)
  To: Lu Baolu
  Cc: Joerg Roedel, iommu, linux-kernel, Ashok Raj, # v4 . 4+, jacob.jun.pan

On Sat, 24 Feb 2018 13:42:27 +0800
Lu Baolu <baolu.lu@linux.intel.com> wrote:

> A memory block was allocated in intel_svm_bind_mm() but never freed
> in a failure path. This patch fixes this by free it to avoid memory
> leakage.
> 
looks good to me.

Thanks,
> Cc: Ashok Raj <ashok.raj@intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.4+
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> ---
>  drivers/iommu/intel-svm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
> index 35a408d..3d4b924 100644
> --- a/drivers/iommu/intel-svm.c
> +++ b/drivers/iommu/intel-svm.c
> @@ -396,6 +396,7 @@ int intel_svm_bind_mm(struct device *dev, int
> *pasid, int flags, struct svm_dev_ pasid_max - 1, GFP_KERNEL);
>  		if (ret < 0) {
>  			kfree(svm);
> +			kfree(sdev);
>  			goto out;
>  		}
>  		svm->pasid = ret;

[Jacob Pan]

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

* Re: [PATCH 1/1] iommu/vt-d: Fix a potential memory leak
  2018-02-24  5:42 [PATCH 1/1] iommu/vt-d: Fix a potential memory leak Lu Baolu
  2018-02-28 15:10 ` Jacob Pan
@ 2018-03-15 14:16 ` Joerg Roedel
  1 sibling, 0 replies; 3+ messages in thread
From: Joerg Roedel @ 2018-03-15 14:16 UTC (permalink / raw)
  To: Lu Baolu; +Cc: iommu, linux-kernel, Ashok Raj, Jacob Pan, # v4 . 4+

On Sat, Feb 24, 2018 at 01:42:27PM +0800, Lu Baolu wrote:
> A memory block was allocated in intel_svm_bind_mm() but never freed
> in a failure path. This patch fixes this by free it to avoid memory
> leakage.
> 
> Cc: Ashok Raj <ashok.raj@intel.com>
> Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>
> Cc: <stable@vger.kernel.org> # v4.4+
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>

Applied, thanks.

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

end of thread, other threads:[~2018-03-15 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-24  5:42 [PATCH 1/1] iommu/vt-d: Fix a potential memory leak Lu Baolu
2018-02-28 15:10 ` Jacob Pan
2018-03-15 14:16 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).