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] [day] [month] [year] [list]
Message-ID: <a1e5ed93-6396-4ffe-9f4f-adb36e89ead0@web.de>
Date: Sun, 31 Dec 2023 09:43:27 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Peter Oberparleiter <oberpar@...ux.ibm.com>,
 kernel-janitors@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 3/3] gcov: Improve exception handling in add_links()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 31 Dec 2023 09:23:50 +0100

The kfree() function was called in one case by
the add_links() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.

Thus use another label.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 kernel/gcov/fs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index 10916c70fad9..80c221bb7f20 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -490,7 +490,8 @@ static void add_links(struct gcov_node *node, struct dentry *parent)
 				gcov_info_filename(get_node_info(node)),
 				&gcov_link[i]);
 		if (!target)
-			goto out_err;
+			goto remove_links;
+
 		basename = kbasename(target);
 		if (basename == target)
 			goto out_err;
@@ -502,6 +503,7 @@ static void add_links(struct gcov_node *node, struct dentry *parent)
 	return;
 out_err:
 	kfree(target);
+remove_links:
 	while (i-- > 0)
 		debugfs_remove(node->links[i]);
 	kfree(node->links);
--
2.43.0


Powered by blists - more mailing lists