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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190128171133.539-2-christian@brauner.io>
Date:   Mon, 28 Jan 2019 18:11:33 +0100
From:   Christian Brauner <christian@...uner.io>
To:     linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
        linux-fsdevel@...r.kernel.org
Cc:     gregkh@...uxfoundation.org, ebiederm@...ssion.com,
        ebiggers@...gle.com, willy@...radead.org, dhowells@...hat.com,
        Christian Brauner <christian@...uner.io>
Subject: [PATCH 2/2] devpts: simplify devpts_fill_super()

When devpts_fill_super() fails deactivate_locked_super() will cleanup
dentries for us so there's no need to do that work in devpts_fill_super()
itself. This allows us to simplify that function quite a bit.

Cc: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Christian Brauner <christian@...uner.io>
---
 fs/devpts/inode.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 8fa1492f9712..59b7625a2110 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -450,19 +450,18 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
 	s->s_op = &devpts_sops;
 	s->s_time_gran = 1;
 
-	error = -ENOMEM;
 	s->s_fs_info = new_pts_fs_info(s);
 	if (!s->s_fs_info)
-		goto fail;
+		return -ENOMEM;
 
 	error = parse_mount_options(data, PARSE_MOUNT, &DEVPTS_SB(s)->mount_opts);
 	if (error)
-		goto fail;
+		return error;
 
-	error = -ENOMEM;
 	inode = new_inode(s);
 	if (!inode)
-		goto fail;
+		return -ENOMEM;
+
 	inode->i_ino = 1;
 	inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
 	inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
@@ -473,19 +472,10 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
 	s->s_root = d_make_root(inode);
 	if (!s->s_root) {
 		pr_err("get root dentry failed\n");
-		goto fail;
+		return -ENOMEM;
 	}
 
-	error = mknod_ptmx(s);
-	if (error)
-		goto fail_dput;
-
-	return 0;
-fail_dput:
-	dput(s->s_root);
-	s->s_root = NULL;
-fail:
-	return error;
+	return mknod_ptmx(s);
 }
 
 /*
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ