Patch "platform/x86: think-lmi: Fix memory leaks when parsing ThinkStation WMI strings" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    platform/x86: think-lmi: Fix memory leaks when parsing ThinkStation WMI strings

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     platform-x86-think-lmi-fix-memory-leaks-when-parsing.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f7110a040e9e1e895bba63cfd95b2eb2bccc5e8d
Author: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
Date:   Sun Apr 2 21:31:19 2023 -0400

    platform/x86: think-lmi: Fix memory leaks when parsing ThinkStation WMI strings
    
    [ Upstream commit e7d796fccdc8d17c2d21817ebe4c7bf5bbfe5433 ]
    
    My previous commit introduced a memory leak where the item allocated
    from tlmi_setting was not freed.
    This commit also renames it to avoid confusion with the similarly name
    variable in the same function.
    
    Fixes: 8a02d70679fc ("platform/x86: think-lmi: Add possible_values for ThinkStation")
    Reported-by: Mirsad Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/lkml/df26ff45-8933-f2b3-25f4-6ee51ccda7d8@xxxxxx/T/
    Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20230403013120.2105-1-mpearson-lenovo@xxxxxxxxx
    Tested-by: Mario Limonciello <mario.limonciello@xxxxxxx>
    Tested-by: Mirsad Goran Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
    Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 5676587271988..ded3aacb26cc9 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -952,10 +952,10 @@ static int tlmi_analyze(void)
 			 * name string.
 			 * Try and pull that out if it's available.
 			 */
-			char *item, *optstart, *optend;
+			char *optitem, *optstart, *optend;
 
-			if (!tlmi_setting(setting->index, &item, LENOVO_BIOS_SETTING_GUID)) {
-				optstart = strstr(item, "[Optional:");
+			if (!tlmi_setting(setting->index, &optitem, LENOVO_BIOS_SETTING_GUID)) {
+				optstart = strstr(optitem, "[Optional:");
 				if (optstart) {
 					optstart += strlen("[Optional:");
 					optend = strstr(optstart, "]");
@@ -964,6 +964,7 @@ static int tlmi_analyze(void)
 							kstrndup(optstart, optend - optstart,
 									GFP_KERNEL);
 				}
+				kfree(optitem);
 			}
 		}
 		/*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux