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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230413044602.3221453-1-zenghao@kylinos.cn>
Date:   Thu, 13 Apr 2023 12:46:02 +0800
From:   Hao Zeng <zenghao@...inos.cn>
To:     trenn@...e.com, shuah@...nel.org, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     Hao Zeng <zenghao@...inos.cn>
Subject: [PATCH] cpupower:Fix resource leaks in sysfs_get_enabled()

The sysfs_get_enabled() opened file processor not closed,
may cause a file handle leak.

Signed-off-by: Hao Zeng <zenghao@...inos.cn>
---
 tools/power/cpupower/lib/powercap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/power/cpupower/lib/powercap.c b/tools/power/cpupower/lib/powercap.c
index 0ce29ee4c2e4..a39ee1c89679 100644
--- a/tools/power/cpupower/lib/powercap.c
+++ b/tools/power/cpupower/lib/powercap.c
@@ -51,7 +51,7 @@ static int sysfs_get_enabled(char *path, int *mode)
 		close(fd);
 		return -1;
 	}
-
+	close(fd);
 	if (yes_no == '1') {
 		*mode = 1;
 		return 0;
-- 
2.37.2


No virus found
		Checked by Hillstone Network AntiVirus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ