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-next>] [day] [month] [year] [list]
Message-ID: <AOUAJQBgDcHjy8iGeDq3e4rT.1.1604995817639.Hmail.bernard@vivo.com>
Date:   Tue, 10 Nov 2020 16:10:17 +0800 (GMT+08:00)
From:   Bernard <bernard@...o.com>
To:     Zhang Rui <rui.zhang@...el.com>,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Amit Kucheria <amitk@...nel.org>, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     opensource.kernel@...o.com, Bernard Zhao <bernard@...o.com>
Subject: [Resend][PATCH] drivers/thermal: fix potential memleak in error branch

Function __thermal_cooling_device_register, when device_register
failed, cdev is not free after error value return, this may
bring in potential memleak.

Signed-off-by: Bernard Zhao <bernard@...o.com>
---
 drivers/thermal/thermal_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 3d1e0033bf3e..e4bee15dfa1f 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1125,6 +1125,7 @@ __thermal_cooling_device_register(struct device_node *np,
 	if (result) {
 		ida_simple_remove(&thermal_cdev_ida, cdev->id);
 		put_device(&cdev->device);
+		kfree(cdev);
 		return ERR_PTR(result);
 	}
 
-- 
2.29.0



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ