Home Home > GIT Browse > SLE12-SP3-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-07-06 20:03:57 +0200
committerTakashi Iwai <tiwai@suse.de>2018-07-06 20:03:57 +0200
commitd0cd43a7e4df10fe01ef54c22ded71fc6fd778df (patch)
treeb7005897c867cf253c162e65b9f56726857a6cb9
parent7f6b0829b29f68156167c0df56213684f174f486 (diff)
parent1ab36524fad90cbb3552141a5b15d728511cad51 (diff)
Merge branch 'users/rgoldwyn/cve/linux-4.4/for-next' into SLE12-SP3
-rw-r--r--fs/inode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 45a5d56aa88b..0d8f54758333 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1943,8 +1943,14 @@ 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;