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>] [day] [month] [year] [list]
Message-Id: <20250114081501.110336-1-liuye@kylinos.cn>
Date: Tue, 14 Jan 2025 16:15:01 +0800
From: liuye <liuye@...inos.cn>
To: shuah@...nel.org
Cc: linux-kselftest@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	liuye <liuye@...inos.cn>
Subject: [PATCH] selftests/timens/procfs: Fix Resource leak proc in read_proc_uptime

    Exception branch returns without closing proc.
Signed-off-by: liuye <liuye@...inos.cn>
---
 tools/testing/selftests/timens/procfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/timens/procfs.c b/tools/testing/selftests/timens/procfs.c
index 1833ca97eb24..e47844a73c31 100644
--- a/tools/testing/selftests/timens/procfs.c
+++ b/tools/testing/selftests/timens/procfs.c
@@ -79,9 +79,11 @@ static int read_proc_uptime(struct timespec *uptime)
 	if (fscanf(proc, "%lu.%02lu", &up_sec, &up_nsec) != 2) {
 		if (errno) {
 			pr_perror("fscanf");
+			fclose(proc);
 			return -errno;
 		}
 		pr_err("failed to parse /proc/uptime");
+		fclose(proc);
 		return -1;
 	}
 	fclose(proc);
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ