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 <[email protected]>
Cc: <[email protected]> # v4.4+
Signed-off-by: Lu Baolu <[email protected]>
Fixes: 2f26e0a9c9 ('iommu/vt-d: Add basic SVM PASID support')
Signed-off-by: Joerg Roedel <[email protected]>
This commit is contained in:
Lu Baolu 2018-02-24 13:42:27 +08:00 • committed by Joerg Roedel
commit bbe4b3af9d

View file

@ -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;