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: <81165091-3dcf-4693-8e8f-658cb95dbbb7@web.de>
Date: Tue, 4 Mar 2025 14:14:23 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: kernel-janitors@...r.kernel.org, linux-ext4@...r.kernel.org,
 Andreas Dilger <adilger.kernel@...ger.ca>,
 Carlos Maiolino <cmaiolino@...hat.com>, Eric Biggers <ebiggers@...gle.com>,
 Theodore Ts'o <tytso@....edu>
Cc: cocci@...ia.fr, LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH RESEND] ext4: Fix exception handling in
 parse_apply_sb_mount_options()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 21 Mar 2023 22:33:06 +0100

The label “out_free” was used to jump to another pointer check
despite of the detail in the implementation of the function
“parse_apply_sb_mount_options” that it was determined already
that a corresponding variable contained a null pointer.

* Thus use an additional label.

* Delete a redundant check.


This issue was detected by using the Coccinelle software.

Fixes: 7edfd85b1ffd ("ext4: Completely separate options parsing and sb setup")
Fixes: c069db76ed7b ("ext4: fix memory leak in parse_apply_sb_mount_options()")
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/ext4/super.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index e6d84c1e34a4..c0bc46956353 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2435,7 +2435,7 @@ static int parse_apply_sb_mount_options(struct super_block *sb,

 	fc = kzalloc(sizeof(struct fs_context), GFP_KERNEL);
 	if (!fc)
-		goto out_free;
+		goto free_mount_opts;

 	s_ctx = kzalloc(sizeof(struct ext4_fs_context), GFP_KERNEL);
 	if (!s_ctx)
@@ -2467,10 +2467,9 @@ static int parse_apply_sb_mount_options(struct super_block *sb,
 	ret = 0;

 out_free:
-	if (fc) {
-		ext4_fc_free(fc);
-		kfree(fc);
-	}
+	ext4_fc_free(fc);
+	kfree(fc);
+free_mount_opts:
 	kfree(s_mount_opts);
 	return ret;
 }
--
2.40.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ