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-next>] [day] [month] [year] [list]
Date:   Fri, 15 Jul 2022 15:53:43 +0800
From:   williamsukatube@....com
To:     miklos@...redi.hu, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     William Dean <williamsukatube@...il.com>,
        Hacash Robot <hacashRobot@...tino.com>
Subject: [PATCH] fuse: Fix a potential memory leak for kstrdup()

From: William Dean <williamsukatube@...il.com>

kfree() is missing on an error path to free the memory allocated by
kstrdup():

  sb->s_subtype = kstrdup(parent_sb->s_subtype, GFP_KERNEL);

So it is better to free it via kfree(sb->s_subtype).

Fixes: 1866d779d5d2a ("fuse: Allow fuse_fill_super_common() for submounts")
Reported-by: Hacash Robot <hacashRobot@...tino.com>
Signed-off-by: William Dean <williamsukatube@...il.com>
---
 fs/fuse/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 8c0665c5dff8..2d10afad07f8 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1449,8 +1449,10 @@ static int fuse_fill_super_submount(struct super_block *sb,
 	get_fuse_inode(root)->nlookup--;
 	sb->s_d_op = &fuse_dentry_operations;
 	sb->s_root = d_make_root(root);
-	if (!sb->s_root)
+	if (!sb->s_root) {
+		kfree(sb->s_subtype);
 		return -ENOMEM;
+	}
 
 	return 0;
 }
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ