Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: EINJ: Fix einj_tab memleak in einj_probe()
@ 2025-08-07 11:56 Zhen Ni
  2025-08-07 12:52 ` zhen.ni
  0 siblings, 1 reply; 2+ messages in thread
From: Zhen Ni @ 2025-08-07 11:56 UTC (permalink / raw)
  To: rafael, tony.luck, bp, guohanjun, mchehab, xueshuai, lenb
  Cc: linux-acpi, Zhen Ni, stable

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


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

end of thread, other threads:[~2025-08-07 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 11:56 [PATCH] ACPI: APEI: EINJ: Fix einj_tab memleak in einj_probe() Zhen Ni
2025-08-07 12:52 ` zhen.ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox