iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/amd: Fix possible memory leak of 'domain'
@ 2023-06-06  7:07 Su Hui
  2023-06-07  4:19 ` Vasant Hegde
  2023-06-07 14:22 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Su Hui @ 2023-06-06  7:07 UTC (permalink / raw)
  To: Joerg Roedel, Suravee Suthikulpanit, Will Deacon, Robin Murphy
  Cc: jgg, kevin.tian, vasant.hegde, iommu, linux-kernel, Su Hui

free memory of domain before return NULL.

Fixes: 29f54745f245 ("iommu/amd: Add missing domain type checks")
Signed-off-by: Su Hui <suhui@nfschina.com>
---
 drivers/iommu/amd/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index dc1ec6849775..f08e65629c74 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -2094,7 +2094,7 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
 	} else if (type == IOMMU_DOMAIN_DMA || type == IOMMU_DOMAIN_DMA_FQ) {
 		pgtable = amd_iommu_pgtable;
 	} else {
-		return NULL;
+		goto out_err;
 	}
 
 	switch (pgtable) {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-06-07 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06  7:07 [PATCH] iommu/amd: Fix possible memory leak of 'domain' Su Hui
2023-06-07  4:19 ` Vasant Hegde
2023-06-07 14:22 ` Jason Gunthorpe
2023-06-07 14:26   ` Vasant Hegde

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).