Patch "thermal/core: Fix memory leak in the error path" has been added to the 5.10-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

    thermal/core: Fix memory leak in the error path

to the 5.10-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:
     thermal-core-fix-memory-leak-in-the-error-path.patch
and it can be found in the queue-5.10 subdirectory.

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


>From d44616c6cc3e35eea03ecfe9040edfa2b486a059 Mon Sep 17 00:00:00 2001
From: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Date: Fri, 19 Mar 2021 21:22:57 +0100
Subject: thermal/core: Fix memory leak in the error path

From: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>

commit d44616c6cc3e35eea03ecfe9040edfa2b486a059 upstream.

Fix the following error:

 smatch warnings:
 drivers/thermal/thermal_core.c:1020 __thermal_cooling_device_register() warn: possible memory leak of 'cdev'

by freeing the cdev when exiting the function in the error path.

Fixes: 584837618100 ("thermal/drivers/core: Use a char pointer for the cooling device name")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20210319202257.890848-1-daniel.lezcano@xxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/thermal/thermal_core.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1152,6 +1152,7 @@ out_kfree_type:
 out_ida_remove:
 	ida_simple_remove(&thermal_cdev_ida, id);
 out_kfree_cdev:
+	kfree(cdev);
 	return ERR_PTR(ret);
 }
 


Patches currently in stable-queue which might be from daniel.lezcano@xxxxxxxxxx are

queue-5.10/thermal-drivers-broadcom-fix-potential-null-derefere.patch
queue-5.10/thermal-core-fix-memory-leak-in-the-error-path.patch
queue-5.10/thermal-drivers-bcm2711-don-t-clamp-temperature-at-z.patch
queue-5.10/thermal-core-fix-memory-leak-in-__thermal_cooling_de.patch
queue-5.10/thermal-core-fix-a-uaf-bug-in-__thermal_cooling_device_register.patch
queue-5.10/thermal-drivers-imx_sc_thermal-fix-refcount-leak-in-.patch
queue-5.10/thermal-drivers-core-use-a-char-pointer-for-the-cool.patch



[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