From 9f79e3d6c827449dcfde8e93ef1586449945d24a Mon Sep 17 00:00:00 2001 From: Ao Xu Date: Fri, 10 Aug 2018 06:14:25 +0000 Subject: Revert "Fix up non-directory creation in SGID directories" This reverts commit d2c7c52431819aa05d76fae77bb3f95dd0955da1. Change-Id: I096cd7fd49ccad4bd032bb365211930fa1aa74d4 Signed-off-by: Ao Xu --- diff --git a/fs/inode.c b/fs/inode.c index 1d1a957..3844c31 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -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; -- cgit