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: cc580e4126 ("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>
This commit is contained in:
Eric Auger 2019-04-30 09:30:04 +02:00 committed by Joerg Roedel
parent 5daab58043
commit dca4d60f5f
1 changed files with 3 additions and 1 deletions

View File

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