platform/x86: thinkpad_acpi: Fix a memory leak of EFCH MMIO resource
PATCH 1/1 platform/x86: thinkpad_acpi: Fix a memory leak of EFCH MMIO resource
Unlike release_mem_region(), a call to release_resource() does not free the resource, so it has to be freed explicitly to avoid a memory leak.
--- drivers/platform/x86/thinkpad_acpi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/thinkpad_acpi.c +1 -0
@@ -4529,6 +4529,7 @@ static void thinkpad_acpi_amd_s2idle_resiounmap (addr); cleanup_resource:release_resource (res); +kfree (res); }static struct acpi_s2idle_dev_ops thinkpad_acpi_s2idle_dev_ops = {
Signature · 2 lines
Jean Delvare SUSE L3 Support
[Public]
Quoted 11 lines
-----Original Message-----
From: Jean Delvare <[email protected]>
Sent: Tuesday, June 21, 2022 08:55
To: [email protected]; platform-driver- [email protected]
Cc: Henrique de Moraes Holschuh <[email protected]>; Hans de Goede <[email protected]>; Mark Gross <[email protected]>; Limonciello, Mario <[email protected]>
Subject: [PATCH] platform/x86:thinkpad_acpi: Fix a memory leak of EFCH MMIO resource
Quoted 4 lines
Unlike
release_mem_region(), a call torelease_resource()does not free the resource, so it has to be freed explicitly to avoid a memory leak.
Thanks for finding and fixing this.
Quoted 28 lines
Signed-off-by Jean Delvare <[email protected]>Fixes 455cd867b85b ("platform/x86: thinkpad_acpi: Add a s2idle resumequirk for a number of laptops")
Cc: Mario Limonciello <[email protected]>
Cc: Henrique de Moraes Holschuh <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Mark Gross <[email protected]>--- drivers/platform/x86/thinkpad_acpi.c | 1 + 1 file changed, 1 insertion(+)---
linux-5.18.orig/drivers/platform/x86/thinkpad_acpi.c2022-05-22
21:52:31.000000000 +0200
+++linux-5.18/drivers/platform/x86/thinkpad_acpi.c2022-06-21
15:49:31.705166709 +0200drivers/platform/x86/thinkpad_acpi.c +1
-1@@ -4529,6 +4529,7 @@ static void thinkpad_acpi_amd_s2idle_resiounmap (addr); cleanup_resource:release_resource (res); +kfree (res); }static struct acpi_s2idle_dev_ops thinkpad_acpi_s2idle_dev_ops = { --Jean Delvare
SUSE L3 Support
Quoted 5 lines · Mario
Quoted 3 lines
Unlike
release_mem_region(), a call torelease_resource()does not free the resource, so it has to be freed explicitly to avoid a memory leak.Thanks for finding and fixing this.
To be honest, credits should go to Yi Zhang at Red Hat. He reported the bug in another driver, all I did was checking if other drivers might suffer from the same issue.
Quoted 1 line
Reviewed-by Mario Limonciello <[email protected]>
Thanks!
Signature · 2 lines
Jean Delvare SUSE L3 Support
Hi,
Quoted 10 lines · Jean Delvare
Unlike
release_mem_region(), a call torelease_resource()does not free the resource, so it has to be freed explicitly to avoid a memory leak.Signed-off-by Jean Delvare <[email protected]>Fixes 455cd867b85b ("platform/x86: thinkpad_acpi: Add a s2idle resume quirk for a number of laptops")Cc Mario Limonciello <[email protected]>Cc Henrique de Moraes Holschuh <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 16 lines
--- drivers/platform/x86/thinkpad_acpi.c | 1 + 1 file changed, 1 insertion(+)drivers/platform/x86/thinkpad_acpi.c +1
-0@@ -4529,6 +4529,7 @@ static void thinkpad_acpi_amd_s2idle_resiounmap (addr); cleanup_resource:release_resource (res); +kfree (res); }static struct acpi_s2idle_dev_ops thinkpad_acpi_s2idle_dev_ops = {