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: <54A06B0E.4080709@users.sourceforge.net>
Date:	Sun, 28 Dec 2014 21:41:50 +0100
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	Eric Van Hensbergen <ericvh@...il.com>,
	Latchesar Ionkov <lucho@...kov.net>,
	Ron Minnich <rminnich@...dia.gov>,
	v9fs-developer@...ts.sourceforge.net
CC:	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 2/8] fs/9p: One function call less in v9fs_create() after
 error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 28 Dec 2014 08:28:51 +0100

The p9_client_clunk() function was called in two cases by the v9fs_create()
function during error handling even if the passed variable "fid"
contained a null pointer. This implementation detail could be improved
by the introduction of another jump label.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 fs/9p/vfs_inode.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index a787d4c..81b945a 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -672,7 +672,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 	err = p9_client_fcreate(ofid, name, perm, mode, extension);
 	if (err < 0) {
 		p9_debug(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
-		goto error;
+		goto ofid_clunk;
 	}
 
 	if (!(perm & P9_DMLINK)) {
@@ -682,8 +682,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 			err = PTR_ERR(fid);
 			p9_debug(P9_DEBUG_VFS,
 				   "p9_client_walk failed %d\n", err);
-			fid = NULL;
-			goto error;
+			goto ofid_clunk;
 		}
 		/*
 		 * instantiate inode and assign the unopened fid to the dentry
@@ -693,16 +692,17 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 			err = PTR_ERR(inode);
 			p9_debug(P9_DEBUG_VFS,
 				   "inode creation failed %d\n", err);
-			goto error;
+			goto fid_clunk;
 		}
 		v9fs_fid_add(dentry, fid);
 		d_instantiate(dentry, inode);
 	}
 	return ofid;
-error:
-	p9_client_clunk(ofid);
 
+fid_clunk:
 	p9_client_clunk(fid);
+ofid_clunk:
+	p9_client_clunk(ofid);
 
 	return ERR_PTR(err);
 }
-- 
2.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ