Skip to content

Commit ac6800e

Browse files
xuyang0410brauner
authored andcommitted
fs: Add missing umask strip in vfs_tmpfile
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. Link: https://lore.kernel.org/r/[email protected] Fixes: 60545d0 ("[O_TMPFILE] it's still short a few helpers, but infrastructure should be OK now...") Cc: <[email protected]> # 4.19+ Reported-by: Christian Brauner (Microsoft) <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-and-Tested-by: Jeff Layton <[email protected]> Acked-by: Christian Brauner (Microsoft) <[email protected]> Signed-off-by: Yang Xu <[email protected]> Signed-off-by: Christian Brauner (Microsoft) <[email protected]>
1 parent 2b3416c commit ac6800e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/namei.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3565,6 +3565,8 @@ struct dentry *vfs_tmpfile(struct user_namespace *mnt_userns,
35653565
child = d_alloc(dentry, &slash_name);
35663566
if (unlikely(!child))
35673567
goto out_err;
3568+
if (!IS_POSIXACL(dir))
3569+
mode &= ~current_umask();
35683570
error = dir->i_op->tmpfile(mnt_userns, dir, child, mode);
35693571
if (error)
35703572
goto out_err;

0 commit comments

Comments
 (0)