summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2019-04-30 09:30:04 +0200
committerJoerg Roedel <jroedel@suse.de>2019-05-03 17:34:27 +0200
commitdca4d60f5f8c9263f8f66724fa4750abd32d8db0 (patch)
treec846f7437df8d84baa27998fda454fb457ec1150 /drivers/iommu
parent5daab58043ee2bca861068e2595564828f3bc663 (diff)
downloadlinux-dca4d60f5f8c9263f8f66724fa4750abd32d8db0.tar.bz2
iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path
If alloc_pages_node() fails, pasid_table is leaked. Free it. Fixes: cc580e41260db ("iommu/vt-d: Per PCI device pasid table interfaces") Signed-off-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-pasid.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iommu/intel-pasid.c b/drivers/iommu/intel-pasid.c
index 03b12d2ee213..2fefeafda437 100644
--- a/drivers/iommu/intel-pasid.c
+++ b/drivers/iommu/intel-pasid.c
@@ -154,8 +154,10 @@ int intel_pasid_alloc_table(struct device *dev)
order = size ? get_order(size) : 0;
pages = alloc_pages_node(info->iommu->node,
GFP_KERNEL | __GFP_ZERO, order);
- if (!pages)
+ if (!pages) {
+ kfree(pasid_table);
return -ENOMEM;
+ }
pasid_table->table = page_address(pages);
pasid_table->order = order;