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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1431555975-25997-15-git-send-email-viro@ZenIV.linux.org.uk>
Date:	Wed, 13 May 2015 23:26:09 +0100
From:	Al Viro <viro@...IV.linux.org.uk>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Neil Brown <neilb@...e.de>, Christoph Hellwig <hch@...radead.org>,
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH 15/21] namei: fold path_cleanup() into terminate_walk()

From: Al Viro <viro@...iv.linux.org.uk>

they are always called next to each other; moreover,
terminate_walk() is more symmetrical that way.

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 fs/namei.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index bd45300..59a4662 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -584,6 +584,10 @@ static void terminate_walk(struct nameidata *nd)
 		path_put(&nd->path);
 		for (i = 0; i < nd->depth; i++)
 			path_put(&nd->stack[i].link);
+		if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) {
+			path_put(&nd->root);
+			nd->root.mnt = NULL;
+		}
 	} else {
 		nd->flags &= ~LOOKUP_RCU;
 		if (!(nd->flags & LOOKUP_ROOT))
@@ -2049,14 +2053,6 @@ static const char *path_init(int dfd, const struct filename *name,
 	return ERR_PTR(-ECHILD);
 }
 
-static void path_cleanup(struct nameidata *nd)
-{
-	if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) {
-		path_put(&nd->root);
-		nd->root.mnt = NULL;
-	}
-}
-
 static const char *trailing_symlink(struct nameidata *nd)
 {
 	const char *s;
@@ -2112,7 +2108,6 @@ static int path_lookupat(int dfd, const struct filename *name, unsigned flags,
 		nd->path.dentry = NULL;
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 	return err;
 }
 
@@ -2160,7 +2155,6 @@ static int path_parentat(int dfd, const struct filename *name,
 		nd->path.dentry = NULL;
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 	return err;
 }
 
@@ -2444,7 +2438,6 @@ path_mountpoint(int dfd, const struct filename *name, struct path *path,
 		}
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 	return err;
 }
 
@@ -3316,7 +3309,6 @@ static struct file *path_openat(int dfd, struct filename *pathname,
 		}
 	}
 	terminate_walk(nd);
-	path_cleanup(nd);
 out2:
 	if (!(opened & FILE_OPENED)) {
 		BUG_ON(!error);
-- 
2.1.4

--
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