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:	Mon, 2 Nov 2015 14:07:39 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Daniel Borkmann <daniel@...earbox.net>
Cc:	viro@...IV.linux.org.uk, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracefs, debugfs: fix refcount imbalance in
 start_creating

On Fri,  9 Oct 2015 20:30:10 +0200
Daniel Borkmann <daniel@...earbox.net> wrote:

> In tracefs' start_creating(), we pin the file system to safely access
> its root. When we failed to create a file, we unpin the file system via
> failed_creating() to release the mount count and eventually the reference
> of the vfsmount.
> 
> However, when we run into an error during lookup_one_len() when still
> in start_creating(), we only release the parent's mutex but not so the
> reference on the mount.
> 
> F.e., in securityfs, after doing simple_pin_fs() when lookup_one_len()
> fails there, we infact do simple_release_fs(). This seems necessary here
> as well. The same also accounts for debugfs as the start_creating() code
> was probably taken from there. Noticed during code review.
> 
> Fixes: 4282d60689d4 ("tracefs: Add new tracefs file system")
> Fixes: 190afd81e4a5 ("debugfs: split the beginning and the end of __create_file() off")
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> ---
>  fs/debugfs/inode.c | 6 +++++-
>  fs/tracefs/inode.c | 6 +++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> index c711be8..9c8d233 100644
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -271,8 +271,12 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
>  		dput(dentry);
>  		dentry = ERR_PTR(-EEXIST);
>  	}
> -	if (IS_ERR(dentry))
> +
> +	if (IS_ERR(dentry)) {
>  		mutex_unlock(&d_inode(parent)->i_mutex);
> +		simple_release_fs(&debugfs_mount, &debugfs_mount_count);
> +	}
> +
>  	return dentry;
>  }
>  
> diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
> index cbc8d5d..c66f242 100644
> --- a/fs/tracefs/inode.c
> +++ b/fs/tracefs/inode.c
> @@ -340,8 +340,12 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
>  		dput(dentry);
>  		dentry = ERR_PTR(-EEXIST);
>  	}
> -	if (IS_ERR(dentry))
> +
> +	if (IS_ERR(dentry)) {
>  		mutex_unlock(&parent->d_inode->i_mutex);
> +		simple_release_fs(&tracefs_mount, &tracefs_mount_count);
> +	}
> +

Acked-by: Steven Rostedt <rostedt@...dmis.org>

-- Steve

>  	return dentry;
>  }
>  

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