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:   Thu, 30 Jan 2020 15:45:20 +0100
From:   Christian Brauner <christian.brauner@...ntu.com>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     linux-fsdevel@...r.kernel.org,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Aleksa Sarai <cyphar@...har.com>,
        David Howells <dhowells@...hat.com>,
        Eric Biederman <ebiederm@...ssion.com>
Subject: Re: [PATCH 04/17] follow_automount() doesn't need the entire
 nameidata

On Sun, Jan 19, 2020 at 03:17:16AM +0000, Al Viro wrote:
> From: Al Viro <viro@...iv.linux.org.uk>
> 
> only the address of ->total_link_count and the flags
> 
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
>  fs/namei.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index d30a74a18da9..3b6f60c02f8a 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -1133,7 +1133,7 @@ EXPORT_SYMBOL(follow_up);
>   * - return -EISDIR to tell follow_managed() to stop and return the path we
>   *   were called with.
>   */
> -static int follow_automount(struct path *path, struct nameidata *nd)
> +static int follow_automount(struct path *path, int *count, unsigned lookup_flags)
>  {
>  	struct dentry *dentry = path->dentry;
>  
> @@ -1148,13 +1148,12 @@ static int follow_automount(struct path *path, struct nameidata *nd)
>  	 * as being automount points.  These will need the attentions
>  	 * of the daemon to instantiate them before they can be used.
>  	 */
> -	if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
> +	if (!(lookup_flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
>  			   LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
>  	    dentry->d_inode)
>  		return -EISDIR;
>  
> -	nd->total_link_count++;
> -	if (nd->total_link_count >= 40)
> +	if (count && *count++ >= 40)

He, side-effects galore. :)
Isn't this incrementing the address but you want to increment the
counter?
Seems like this should be

if (count && (*count)++ >= 40)

and even then it seems to me not incrementing at all when we have hit
the limit seems more natural?

Christian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ