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: <176351594168.634289.2632498932696325048@noble.neil.brown.name>
Date: Wed, 19 Nov 2025 12:32:21 +1100
From: NeilBrown <neilb@...mail.net>
To: "Benjamin Coddington" <bcodding@...merspace.com>
Cc: "Alexander Viro" <viro@...iv.linux.org.uk>,
 "Christian Brauner" <brauner@...nel.org>, "Jan Kara" <jack@...e.cz>,
 "Chuck Lever" <chuck.lever@...cle.com>, "Jeff Layton" <jlayton@...nel.org>,
 "Olga Kornievskaia" <okorniev@...hat.com>, "Dai Ngo" <Dai.Ngo@...cle.com>,
 "Tom Talpey" <tom@...pey.com>, linux-fsdevel@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-nfs@...r.kernel.org,
 "Trond Myklebust" <trondmy@...nel.org>, "Mike Snitzer" <snitzer@...nel.org>
Subject: Re: [PATCH v1 2/3] VFS: Prepare atomic_open() for dentry_create()

On Wed, 19 Nov 2025, Benjamin Coddington wrote:
> The next patch allows dentry_create() to call atomic_open(), but it does
> not have fabricated nameidata.  Let atomic_open() take a path instead.

I think this commit message could usefully be longer and more details.

 atomic_open() currently takes a nameidata of which it only uses the
 path and the flags.  Flags are only used to update open_flags.  That
 update can happen before atomic_open() is called which would mean that
 only the path need be passed to atomic_open() rather than the whole
 nameidata.  This will make it easier for dentry_create() To call
 atomic_open().
	
Thanks,
NeilBrown

> 
> Signed-off-by: Benjamin Coddington <bcodding@...merspace.com>
> ---
>  fs/namei.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index e2bfd2a73cba..9c0aad5bbff7 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -3552,19 +3552,16 @@ static int may_o_create(struct mnt_idmap *idmap,
>   *
>   * Returns an error code otherwise.
>   */
> -static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry,
> +static struct dentry *atomic_open(const struct path *path, struct dentry *dentry,
>  				  struct file *file,
>  				  int open_flag, umode_t mode)
>  {
>  	struct dentry *const DENTRY_NOT_SET = (void *) -1UL;
> -	struct inode *dir =  nd->path.dentry->d_inode;
> +	struct inode *dir =  path->dentry->d_inode;
>  	int error;
>  
> -	if (nd->flags & LOOKUP_DIRECTORY)
> -		open_flag |= O_DIRECTORY;
> -
>  	file->f_path.dentry = DENTRY_NOT_SET;
> -	file->f_path.mnt = nd->path.mnt;
> +	file->f_path.mnt = path->mnt;
>  	error = dir->i_op->atomic_open(dir, dentry, file,
>  				       open_to_namei_flags(open_flag), mode);
>  	d_lookup_done(dentry);
> @@ -3676,7 +3673,10 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,
>  	if (create_error)
>  		open_flag &= ~O_CREAT;
>  	if (dir_inode->i_op->atomic_open) {
> -		dentry = atomic_open(nd, dentry, file, open_flag, mode);
> +		if (nd->flags & LOOKUP_DIRECTORY)
> +			open_flag |= O_DIRECTORY;
> +
> +		dentry = atomic_open(&nd->path, dentry, file, open_flag, mode);
>  		if (unlikely(create_error) && dentry == ERR_PTR(-ENOENT))
>  			dentry = ERR_PTR(create_error);
>  		return dentry;
> -- 
> 2.50.1
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ