diff --git a/fs/namei.c b/fs/namei.c
index b952ecbd49c2..22d13732e61d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3443,6 +3443,8 @@ struct dentry *vfs_tmpfile(struct dentry *dentry, umode_t mode, int open_flag)
 	child = d_alloc(dentry, &slash_name);
 	if (unlikely(!child))
 		goto out_err;
+	if (!IS_POSIXACL(dir))
+		mode &= ~current_umask();
 	error = dir->i_op->tmpfile(dir, child, mode);
 	if (error)
 		goto out_err;