The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] platform/x86: int1092: Fix potential memory leak in sar_probe()
@ 2026-07-07  7:05 Abdun Nihaal
  2026-07-09 11:31 ` Ilpo Järvinen
  0 siblings, 1 reply; 2+ messages in thread
From: Abdun Nihaal @ 2026-07-07  7:05 UTC (permalink / raw)
  To: s.shravan
  Cc: Abdun Nihaal, hansg, ilpo.jarvinen, platform-driver-x86,
	linux-kernel, stable

The memory allocated for device_mode_info in parse_package() called by
sar_get_data() is not freed in some of the error paths in sar_probe().
Fix that by adding the corresponding free in the error path.

Fixes: dcfbd31ef4bc ("platform/x86: BIOS SAR driver for Intel M.2 Modem")
Cc: stable@vger.kernel.org
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
 drivers/platform/x86/intel/int1092/intel_sar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/intel/int1092/intel_sar.c b/drivers/platform/x86/intel/int1092/intel_sar.c
index 849f7b415c1e..b27fc07c087a 100644
--- a/drivers/platform/x86/intel/int1092/intel_sar.c
+++ b/drivers/platform/x86/intel/int1092/intel_sar.c
@@ -273,13 +273,13 @@ static int sar_probe(struct platform_device *device)
 	if (sar_get_device_mode(device) != AE_OK) {
 		dev_err(&device->dev, "Failed to get device mode\n");
 		result = -EIO;
-		goto r_free;
+		goto r_sar;
 	}
 
 	result = sysfs_create_group(&device->dev.kobj, &intcsar_group);
 	if (result) {
 		dev_err(&device->dev, "sysfs creation failed\n");
-		goto r_free;
+		goto r_sar;
 	}
 
 	if (acpi_install_notify_handler(ACPI_HANDLE(&device->dev), ACPI_DEVICE_NOTIFY,
@@ -292,6 +292,9 @@ static int sar_probe(struct platform_device *device)
 
 r_sys:
 	sysfs_remove_group(&device->dev.kobj, &intcsar_group);
+r_sar:
+	for (reg = 0; reg < MAX_REGULATORY; reg++)
+		kfree(context->config_data[reg].device_mode_info);
 r_free:
 	kfree(context);
 	return result;
-- 
2.43.0


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

end of thread, other threads:[~2026-07-09 11:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07  7:05 [PATCH] platform/x86: int1092: Fix potential memory leak in sar_probe() Abdun Nihaal
2026-07-09 11:31 ` Ilpo Järvinen

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