lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230612021718.82293-1-gehao@kylinos.cn>
Date:   Mon, 12 Jun 2023 10:17:18 +0800
From:   Hao Ge <gehao@...inos.cn>
To:     joro@...tes.org, suravee.suthikulpanit@....com, will@...nel.org,
        robin.murphy@....com
Cc:     kevin.tian@...el.com, jgg@...pe.ca, vasant.hegde@....com,
        iommu@...ts.linux.dev, linux-kernel@...r.kernel.org,
        gehao618@....com, Hao Ge <gehao@...inos.cn>
Subject: [PATCH] iommu/amd: Fix memory leak when domain type checks fail

When domain type checks fail,we also should free protection_domain struct
to avoid memory leak in protection_domain_alloc

Fixes: 29f54745f245 ("iommu/amd: Add missing domain type checks")
Signed-off-by: Hao Ge <gehao@...inos.cn>
---
 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.25.1


No virus found
		Checked by Hillstone Network AntiVirus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ