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>] [day] [month] [year] [list]
Message-Id: <20250225053724.74582-1-dheeraj.linuxdev@gmail.com>
Date: Tue, 25 Feb 2025 11:07:24 +0530
From: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>
To: rostedt@...dmis.org
Cc: catalin.marinas@....com,
	linux-kernel@...r.kernel.org,
	Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>
Subject: [PATCH scripts] scripts/sorttable: Fix resource leak in parse_symbols()

Fix a resource leak in parse_symbols() where the file pointer fp
was not closed if add_field() returned an error. This caused an
open file descriptor to remain unclosed. Ensure that fp is properly
closed before returning an error.

Fixes: ef378c3b8233 ("scripts/sorttable: Zero out weak functions in mcount_loc table")
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@...il.com>
---
 scripts/sorttable.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index 23c7e0e6c024..b9b066c1afee 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -662,8 +662,10 @@ static int parse_symbols(const char *fname)
 
 		addr = strtoull(addr_str, NULL, 16);
 		size = strtoull(size_str, NULL, 16);
-		if (add_field(addr, size) < 0)
+		if (add_field(addr, size) < 0) {
+			fclose(fp);
 			return -1;
+		}
 	}
 	fclose(fp);
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ