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:   Wed, 24 Mar 2021 05:38:43 -0700
From:   zhouchuangao <zhouchuangao@...o.com>
To:     Vivek Goyal <vgoyal@...hat.com>,
        Stefan Hajnoczi <stefanha@...hat.com>,
        Miklos Szeredi <miklos@...redi.hu>,
        virtualization@...ts.linux-foundation.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     zhouchuangao <zhouchuangao@...o.com>
Subject: [PATCH] fs/fuse/virtio_fs: Fix a potential memory allocation failure

Allocate memory for struct fuse_conn may fail, we should not jump to
out_err to kfree(fc).

Signed-off-by: zhouchuangao <zhouchuangao@...o.com>
---
 fs/fuse/virtio_fs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 4ee6f73..1f333c6 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -1430,11 +1430,11 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
 	err = -ENOMEM;
 	fc = kzalloc(sizeof(struct fuse_conn), GFP_KERNEL);
 	if (!fc)
-		goto out_err;
+		goto out_err_fc;
 
 	fm = kzalloc(sizeof(struct fuse_mount), GFP_KERNEL);
 	if (!fm)
-		goto out_err;
+		goto out_err_fm;
 
 	fuse_conn_init(fc, fm, get_user_ns(current_user_ns()),
 		       &virtio_fs_fiq_ops, fs);
@@ -1468,8 +1468,9 @@ static int virtio_fs_get_tree(struct fs_context *fsc)
 	fsc->root = dget(sb->s_root);
 	return 0;
 
-out_err:
+out_err_fm:
 	kfree(fc);
+out_err_fc:
 	mutex_lock(&virtio_fs_mutex);
 	virtio_fs_put(fs);
 	mutex_unlock(&virtio_fs_mutex);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ