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]
Date:	Tue,  5 May 2015 06:22:42 +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 68/79] namei: have terminate_walk() do put_link() on everything left

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

All callers of terminate_walk() are followed by more or less
open-coded eqiuvalent of "do put_link() on everything left
in nd->stack".  Better done in terminate_walk() itself, and
when we go for RCU symlink traversal we'll have to do it
there anyway.

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

diff --git a/fs/namei.c b/fs/namei.c
index 0fbc9b7..3faf3e2 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1554,6 +1554,8 @@ static void terminate_walk(struct nameidata *nd)
 			nd->root.mnt = NULL;
 		rcu_read_unlock();
 	}
+	while (unlikely(nd->depth))
+		put_link(nd);
 }
 
 /*
@@ -1848,8 +1850,6 @@ Walked:
 		}
 	}
 	terminate_walk(nd);
-	while (unlikely(nd->depth))
-		put_link(nd);
 	return err;
 OK:
 	if (!nd->depth)		/* called from path_init(), done */
@@ -2366,8 +2366,6 @@ done:
 	error = 0;
 out:
 	terminate_walk(nd);
-	if (nd->depth)
-		put_link(nd);
 	return error;
 }
 
@@ -2970,8 +2968,6 @@ static int do_last(struct nameidata *nd,
 		error = handle_dots(nd, nd->last_type);
 		if (unlikely(error)) {
 			terminate_walk(nd);
-			if (nd->depth)
-				put_link(nd);
 			return error;
 		}
 		goto finish_open;
@@ -3170,8 +3166,6 @@ out:
 		mnt_drop_write(nd->path.mnt);
 	path_put(&save_parent);
 	terminate_walk(nd);
-	if (nd->depth)
-		put_link(nd);
 	return error;
 
 exit_dput:
-- 
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