Skip to content

Commit 83e85d1

Browse files
J. Bruce FieldsSomasundaram Krishnasamy
authored andcommitted
nfsd: apply umask on fs without ACL support
commit 22cf841 upstream. The server is failing to apply the umask when creating new objects on filesystems without ACL support. To reproduce this, you need to use NFSv4.2 and a client and server recent enough to support umask, and you need to export a filesystem that lacks ACL support (for example, ext4 with the "noacl" mount option). Filesystems with ACL support are expected to take care of the umask themselves (usually by calling posix_acl_create). For filesystems without ACL support, this is up to the caller of vfs_create(), vfs_mknod(), or vfs_mkdir(). Reported-by: Elliott Mitchell <[email protected]> Reported-by: Salvatore Bonaccorso <[email protected]> Tested-by: Salvatore Bonaccorso <[email protected]> Fixes: 47057ab ("nfsd: add support for the umask attribute") Cc: [email protected] Signed-off-by: J. Bruce Fields <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 15fefb108c7af7ec8e19a88caed928d8b88120ff) Orabug: 31779885 CVE: CVE-2020-24394 Signed-off-by: Saeed Mirzamohammadi <[email protected]> Reviewed-by: Jack Vogel <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 48855af commit 83e85d1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/nfsd/vfs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,6 +1202,9 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
12021202
iap->ia_mode = 0;
12031203
iap->ia_mode = (iap->ia_mode & S_IALLUGO) | type;
12041204

1205+
if (!IS_POSIXACL(dirp))
1206+
iap->ia_mode &= ~current_umask();
1207+
12051208
err = 0;
12061209
host_err = 0;
12071210
switch (type) {
@@ -1413,6 +1416,9 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
14131416
goto out;
14141417
}
14151418

1419+
if (!IS_POSIXACL(dirp))
1420+
iap->ia_mode &= ~current_umask();
1421+
14161422
host_err = vfs_create(dirp, dchild, iap->ia_mode, true);
14171423
if (host_err < 0) {
14181424
fh_drop_write(fhp);

0 commit comments

Comments
 (0)