* [PATCH] iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path
@ 2019-04-30 7:30 Eric Auger
2019-05-03 15:34 ` Joerg Roedel
0 siblings, 1 reply; 2+ messages in thread
From: Eric Auger @ 2019-04-30 7:30 UTC (permalink / raw)
To: eric.auger.pro, eric.auger, joro, iommu, linux-kernel; +Cc: dwmw2
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>
---
drivers/iommu/intel-pasid.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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;
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path
2019-04-30 7:30 [PATCH] iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path Eric Auger
@ 2019-05-03 15:34 ` Joerg Roedel
0 siblings, 0 replies; 2+ messages in thread
From: Joerg Roedel @ 2019-05-03 15:34 UTC (permalink / raw)
To: Eric Auger; +Cc: eric.auger.pro, iommu, linux-kernel, dwmw2
On Tue, Apr 30, 2019 at 09:30:04AM +0200, Eric Auger wrote:
> 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>
> ---
> drivers/iommu/intel-pasid.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-03 15:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 7:30 [PATCH] iommu/vt-d: Fix leak in intel_pasid_alloc_table on error path Eric Auger
2019-05-03 15:34 ` Joerg Roedel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).