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>] [day] [month] [year] [list]
Message-Id: <20251223124350.1496325-1-lihaoxiang@isrc.iscas.ac.cn>
Date: Tue, 23 Dec 2025 20:43:50 +0800
From: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
To: bp@...en8.de,
	tony.luck@...el.com,
	akpm@...ux-foundation.org,
	dougthompson@...ssion.com,
	mitake@...stcom.com
Cc: linux-edac@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>,
	stable@...r.kernel.org
Subject: [PATCH] edac x38: fix a resource leak in x38_probe1()

If edac_mc_alloc() fails, also unmap the window.
Add a goto to do so.

Found by code review and compiled on ubuntu 20.04.

Fixes: df8bc08c192f ("edac x38: new MC driver module")
Cc: stable@...r.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@...c.iscas.ac.cn>
---
 drivers/edac/x38_edac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/edac/x38_edac.c b/drivers/edac/x38_edac.c
index 49ab5721aab2..09889b615584 100644
--- a/drivers/edac/x38_edac.c
+++ b/drivers/edac/x38_edac.c
@@ -342,8 +342,10 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)
 	layers[1].size = x38_channel_num;
 	layers[1].is_virt_csrow = false;
 	mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers, 0);
-	if (!mci)
-		return -ENOMEM;
+	if (!mci) {
+		rc = -ENOMEM;
+		goto fail;
+	}
 
 	edac_dbg(3, "MC: init mci\n");
 
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ