Skip to content

Commit

Permalink
iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path
Browse files Browse the repository at this point in the history
If alloc_pages_node() fails, pasid_table is leaked. Free it.

Fixes: cc580e4 ("iommu/vt-d: Per PCI device pasid table interfaces")

Signed-off-by: Eric Auger <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
  • Loading branch information
eauger authored and joergroedel committed May 3, 2019
1 parent 5daab58 commit dca4d60
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iommu/intel-pasid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dca4d60

Please sign in to comment.