]> git.baikalelectronics.ru Git - kernel.git/commit
Fix up non-directory creation in SGID directories
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 4 Jul 2018 00:10:19 +0000 (17:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 5 Jul 2018 19:36:36 +0000 (12:36 -0700)
commitb7c7b802a3edd87ba2c914c5ca3bb8df0e294643
tree380bffd5014564f906357aaf5255e81b7c466353
parent122f1e989636f3ce23db4534a19a6b2c025b05d0
Fix up non-directory creation in SGID directories

sgid directories have special semantics, making newly created files in
the directory belong to the group of the directory, and newly created
subdirectories will also become sgid.  This is historically used for
group-shared directories.

But group directories writable by non-group members should not imply
that such non-group members can magically join the group, so make sure
to clear the sgid bit on non-directories for non-members (but remember
that sgid without group execute means "mandatory locking", just to
confuse things even more).

Reported-by: Jann Horn <jannh@google.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/inode.c