Skip to content

Commit

Permalink
iommu/vt-d: Fix a potential memory leak
Browse files Browse the repository at this point in the history
commit bbe4b3af9d9e3172fb9aa1f8dcdfaedcb381fc64 upstream.

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 <[email protected]>
Cc: <[email protected]> # v4.4+
Signed-off-by: Lu Baolu <[email protected]>
Fixes: 2f26e0a9c9860 ('iommu/vt-d: Add basic SVM PASID support')
Signed-off-by: Joerg Roedel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
LuBaolu authored and Chatur27 committed Dec 27, 2020
1 parent 6a1b4cf commit 277de7b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/iommu/intel-svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,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;
Expand Down

0 comments on commit 277de7b

Please sign in to comment.