All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org,
	viro@zeniv.linux.org.uk, david@fromorbit.com, brauner@kernel.org,
	willy@infradead.org, jlayton@kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v6 2/4] fs: Add missing umask strip in vfs_tmpfile
Date: Mon, 25 Apr 2022 09:54:19 -0700	[thread overview]
Message-ID: <20220425165419.GE16996@magnolia> (raw)
In-Reply-To: <1650856181-21350-2-git-send-email-xuyang2018.jy@fujitsu.com>

On Mon, Apr 25, 2022 at 11:09:39AM +0800, Yang Xu wrote:
> All creation paths except for O_TMPFILE handle umask in the vfs directly
> if the filesystem doesn't support or enable POSIX ACLs. If the filesystem
> does then umask handling is deferred until posix_acl_create().
> Because, O_TMPFILE misses umask handling in the vfs it will not honor
> umask settings. Fix this by adding the missing umask handling.
> 
> Fixes: 60545d0d4610 ("[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now...")

If I had a nickel for every time I felt like I was short a few
helpers... ;)

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> Cc: <stable@vger.kernel.org> # 4.19+
> Reported-by: Christian Brauner (Microsoft) <brauner@kernel.org>
> Acked-by: Christian Brauner (Microsoft) <brauner@kernel.org>
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  fs/namei.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/namei.c b/fs/namei.c
> index 509657fdf4f5..73646e28fae0 100644
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -3521,6 +3521,8 @@ struct dentry *vfs_tmpfile(struct user_namespace *mnt_userns,
>  	child = d_alloc(dentry, &slash_name);
>  	if (unlikely(!child))
>  		goto out_err;
> +	if (!IS_POSIXACL(dir))
> +		mode &= ~current_umask();
>  	error = dir->i_op->tmpfile(mnt_userns, dir, child, mode);
>  	if (error)
>  		goto out_err;
> -- 
> 2.27.0
> 

  reply	other threads:[~2022-04-25 16:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-25  3:09 [PATCH v6 1/4] fs: move sgid strip operation from inode_init_owner into inode_sgid_strip Yang Xu
2022-04-25  2:45 ` Matthew Wilcox
2022-04-25  3:08   ` xuyang2018.jy
2022-04-25 11:29     ` Christian Brauner
2022-04-25 17:33       ` Matthew Wilcox
2022-04-26  1:22         ` xuyang2018.jy
2022-04-25  3:09 ` [PATCH v6 2/4] fs: Add missing umask strip in vfs_tmpfile Yang Xu
2022-04-25 16:54   ` Darrick J. Wong [this message]
2022-04-25  3:09 ` [PATCH v6 3/4] fs: strip file's S_ISGID mode on vfs instead of on underlying filesystem Yang Xu
2022-04-25 16:51   ` Darrick J. Wong
2022-04-26  1:25     ` xuyang2018.jy
2022-04-25  3:09 ` [PATCH v6 4/4] ceph: Remove S_ISGID stripping code in ceph_finish_async_create Yang Xu
2022-04-25 16:53 ` [PATCH v6 1/4] fs: move sgid strip operation from inode_init_owner into inode_sgid_strip Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220425165419.GE16996@magnolia \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=david@fromorbit.com \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=xuyang2018.jy@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.