Skip to contentSkip to conversation

iommu/vt-d: Fix a potential memory leak

PATCH Applied Lu Baolu 3 participants 3 messages Feb 24, 2018 – Mar 15, 2018

Subsystems (2)
lore
Share & tools
lore

Lu Baolu

author
#0 lore raw

PATCH 1/1 iommu/vt-d: Fix a potential memory leak

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 <[email protected]>
Cc Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/[email protected]>
Cc <[email protected]> # v4.4+
---
 drivers/iommu/intel-svm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iommu/intel-svm.c +1 -0
index 35a408d..3d4b924 100644
@@ -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;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · On Sat, 24 Feb 2018 13:42:27 +0800 Lu Baolu…

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,

Quoted 13 lines
Cc Ashok Raj <[email protected]>
Cc Jacob Pan <jacob.jun.pan-VuQAYsv1563Yd54FQh9/[email protected]>
Cc <[email protected]> # v4.4+
---
 drivers/iommu/intel-svm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/iommu/intel-svm.c +0 -0
index 35a408d..3d4b924 100644

drivers/iommu/intel-svm.c int intel_svm_bind_mm(struct device *dev, int · line 402

Quoted 7 lines
drivers/iommu/intel-svm.c +1 -0
@@ -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]