Skip to content

Commit 497de07

Browse files
Gu ZhengAl Viro
authored andcommitted
tmpfs: clear S_ISGID when setting posix ACLs
This change was missed the tmpfs modification in In CVE-2016-7097 commit 0739310 ("posix_acl: Clear SGID bit when setting file permissions") It can test by xfstest generic/375, which failed to clear setgid bit in the following test case on tmpfs: touch $testfile chown 100:100 $testfile chmod 2755 $testfile _runas -u 100 -g 101 -- setfacl -m u::rwx,g::rwx,o::rwx $testfile Signed-off-by: Gu Zheng <guzheng1@huawei.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent b4b8664 commit 497de07

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/posix_acl.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,10 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
922922
int error;
923923

924924
if (type == ACL_TYPE_ACCESS) {
925-
error = posix_acl_equiv_mode(acl, &inode->i_mode);
926-
if (error < 0)
927-
return 0;
928-
if (error == 0)
929-
acl = NULL;
925+
error = posix_acl_update_mode(inode,
926+
&inode->i_mode, &acl);
927+
if (error)
928+
return error;
930929
}
931930

932931
inode->i_ctime = current_time(inode);

0 commit comments

Comments
 (0)