Revert "Fix up non-directory creation in SGID directories"
authorAo Xu <ao.xu@amlogic.com>
Fri, 10 Aug 2018 06:14:25 +0000 (02:14 -0400)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 14 Aug 2018 10:25:14 +0000 (03:25 -0700)
This reverts commit d2c7c52431819aa05d76fae77bb3f95dd0955da1.

Change-Id: I096cd7fd49ccad4bd032bb365211930fa1aa74d4
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
fs/inode.c

index 1d1a957..3844c31 100644 (file)
@@ -2003,14 +2003,8 @@ void inode_init_owner(struct inode *inode, const struct inode *dir,
        inode->i_uid = current_fsuid();
        if (dir && dir->i_mode & S_ISGID) {
                inode->i_gid = dir->i_gid;
-
-               /* Directories are special, and always inherit S_ISGID */
                if (S_ISDIR(mode))
                        mode |= S_ISGID;
-               else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
-                        !in_group_p(inode->i_gid) &&
-                        !capable_wrt_inode_uidgid(dir, CAP_FSETID))
-                       mode &= ~S_ISGID;
        } else
                inode->i_gid = current_fsgid();
        inode->i_mode = mode;