lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230724071646.2744900-2-peng.fan@oss.nxp.com>
Date:   Mon, 24 Jul 2023 15:16:45 +0800
From:   "Peng Fan (OSS)" <peng.fan@....nxp.com>
To:     rafael@...nel.org, daniel.lezcano@...aro.org
Cc:     amitk@...nel.org, rui.zhang@...el.com, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Peng Fan <peng.fan@....com>
Subject: [PATCH V2 1/2] thermal/core: fix potential memory leak

From: Peng Fan <peng.fan@....com>

thermal_set_governor will allocate memory for tz->governor_data by
calling power_allocator_bind, so need free it in failure handling path.

Addresses-Coverity: 25777220 ("Memory leak")
Fixes: e33df1d2f3a0 ("thermal: let governors have private data for each thermal zone")
Signed-off-by: Peng Fan <peng.fan@....com>
---
 drivers/thermal/thermal_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index cc2b5e81c620..fe5eef149695 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1355,6 +1355,9 @@ thermal_zone_device_register_with_trips(const char *type, struct thermal_trip *t
 	return tz;
 
 unregister:
+	if (tz->governor && tz->governor->unbind_from_tz)
+		tz->governor->unbind_from_tz(tz);
+
 	device_del(&tz->device);
 release_device:
 	put_device(&tz->device);
-- 
2.37.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ