From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DCC7E36E471; Wed, 21 Jan 2026 18:32:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769020353; cv=none; b=byN8hU+F91qD7EiNtdSmXcZ5Lc/6Uy3WJLBnMkxPdxMw6dw2xuYVEjYEg5PRVER59cmGmGouEOLrpjIuRI+UbduXKdwPnbsESsfRVY/mCAo3XQoRClhgQ3EPNqFlgWlE7rihml1THCSDc1ffixiFKLGZS9jhiBPr/UcWLVpvILQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769020353; c=relaxed/simple; bh=DdqZeby7WklILxJxbLTRzmyfVbcr5MLO3gFdSQZbDXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l/bpY0ur+nqVrHk8OxKeXFFmx7bR/1MmjZrWz45jcF6RZwLObSfAPhps3OEAU06aT/u1IKEqvLQx7nbiFVMHSCrEw2W2igNhkfDNe3OXl2n3WzSUnC1bygkA0Jf48DRati2OXtke83Wk7TpUhWcm0jLjyKSPudo+dyiRPymr2bg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DPFk4KLh; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DPFk4KLh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14C87C4CEF1; Wed, 21 Jan 2026 18:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1769020352; bh=DdqZeby7WklILxJxbLTRzmyfVbcr5MLO3gFdSQZbDXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DPFk4KLhBXdhBrgFaYb9lLwfOuuha6S7QUPjttSEQUAsYf2jZDf+lsRD7azoc0X8W jap+5Rs9SVTak03KGYHbT400UM0IqjRWEEcbA9Xddqz7WSaLQn7VZTsin2ZONpdSgb qiiV9fneYC2aGrSqsx+481zYwegdOsUb0JEkj/iU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haoxiang Li , "Borislav Petkov (AMD)" Subject: [PATCH 6.18 131/198] EDAC/x38: Fix a resource leak in x38_probe1() Date: Wed, 21 Jan 2026 19:15:59 +0100 Message-ID: <20260121181423.263134968@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260121181418.537774329@linuxfoundation.org> References: <20260121181418.537774329@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haoxiang Li commit 0ff7c44106b4715fc27a2e455d9f57f1dfcfd54f upstream. If edac_mc_alloc() fails, also unmap the window. [ bp: Use separate labels, turning it into the classic unwind pattern. ] Fixes: df8bc08c192f ("edac x38: new MC driver module") Signed-off-by: Haoxiang Li Signed-off-by: Borislav Petkov (AMD) Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20251223124350.1496325-1-lihaoxiang@isrc.iscas.ac.cn Signed-off-by: Greg Kroah-Hartman --- drivers/edac/x38_edac.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/edac/x38_edac.c +++ b/drivers/edac/x38_edac.c @@ -341,9 +341,12 @@ static int x38_probe1(struct pci_dev *pd layers[1].type = EDAC_MC_LAYER_CHANNEL; layers[1].size = x38_channel_num; layers[1].is_virt_csrow = false; + + + rc = -ENOMEM; mci = edac_mc_alloc(0, ARRAY_SIZE(layers), layers, 0); if (!mci) - return -ENOMEM; + goto unmap; edac_dbg(3, "MC: init mci\n"); @@ -403,9 +406,9 @@ static int x38_probe1(struct pci_dev *pd return 0; fail: + edac_mc_free(mci); +unmap: iounmap(window); - if (mci) - edac_mc_free(mci); return rc; }