From: Zhen Ni <zhen.ni@easystack.cn>
To: rafael@kernel.org, tony.luck@intel.com, bp@alien8.de,
guohanjun@huawei.com, mchehab@kernel.org,
xueshuai@linux.alibaba.com, lenb@kernel.org
Cc: linux-acpi@vger.kernel.org, Zhen Ni <zhen.ni@easystack.cn>,
stable@vger.kernel.org
Subject: [PATCH] ACPI: APEI: EINJ: Fix einj_tab memleak in einj_probe()
Date: Thu, 7 Aug 2025 19:56:57 +0800 [thread overview]
Message-ID: <20250807115657.503189-1-zhen.ni@easystack.cn> (raw)
Fixes a permanent ACPI table memory leak when einj_probe() return 0 by
adding acpi_put_table().
Remove the assignment rc = -ENOMEM to allow the function to propagate
the actual return value.
Fixes: e40213450b53 ("ACPI, APEI, EINJ support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
drivers/acpi/apei/einj-core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/apei/einj-core.c b/drivers/acpi/apei/einj-core.c
index bf8dc92a373a..919caa819cf8 100644
--- a/drivers/acpi/apei/einj-core.c
+++ b/drivers/acpi/apei/einj-core.c
@@ -990,7 +990,7 @@ static bool setup_einjv2_component_files(void)
static int __init einj_probe(struct faux_device *fdev)
{
- int rc;
+ int rc = 0;
acpi_status status;
struct apei_exec_context ctx;
@@ -1015,7 +1015,6 @@ static int __init einj_probe(struct faux_device *fdev)
if (rc)
goto err_put_table;
- rc = -ENOMEM;
einj_debug_dir = debugfs_create_dir("einj", apei_get_debugfs_dir());
debugfs_create_file("available_error_type", S_IRUSR, einj_debug_dir,
@@ -1078,7 +1077,7 @@ static int __init einj_probe(struct faux_device *fdev)
pr_info("Error INJection is initialized.\n");
- return 0;
+ goto err_put_table;
err_release:
apei_resources_release(&einj_resources);
--
2.20.1
next reply other threads:[~2025-08-07 13:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 11:56 Zhen Ni [this message]
2025-08-07 12:52 ` [PATCH] ACPI: APEI: EINJ: Fix einj_tab memleak in einj_probe() zhen.ni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250807115657.503189-1-zhen.ni@easystack.cn \
--to=zhen.ni@easystack.cn \
--cc=bp@alien8.de \
--cc=guohanjun@huawei.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=xueshuai@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox