summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-12-04 03:58:56 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-12-04 03:58:56 +0000
commit1d67e90f19a7acfd9a05dc59678e7d0c5090bd0d (patch)
tree357efc7b93f8f5102110d20d293f41360ec212fc /fs/open.c
parentaea27b2e18d69af87e673972246e66657b4fa274 (diff)
Merge with Linux 2.3.21.
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index 5a86dc48a..3caaa53ce 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -526,10 +526,13 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
* non-root user, remove the setuid bit.
* 19981026 David C Niemi <niemi@tux.org>
*
+ * Changed this to apply to all users, including root, to avoid
+ * some races. This is the behavior we had in 2.0. The check for
+ * non-root was definitely wrong for 2.2 anyway, as it should
+ * have been using CAP_FSETID rather than fsuid -- 19990830 SD.
*/
if ((inode->i_mode & S_ISUID) == S_ISUID &&
- !S_ISDIR(inode->i_mode)
- && current->fsuid)
+ !S_ISDIR(inode->i_mode))
{
newattrs.ia_mode &= ~S_ISUID;
newattrs.ia_valid |= ATTR_MODE;
@@ -539,9 +542,11 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
* by a non-root user, remove the setgid bit UNLESS there is no group
* execute bit (this would be a file marked for mandatory locking).
* 19981026 David C Niemi <niemi@tux.org>
+ *
+ * Removed the fsuid check (see the comment above) -- 19990830 SD.
*/
if (((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP))
- && !S_ISDIR(inode->i_mode) && current->fsuid)
+ && !S_ISDIR(inode->i_mode))
{
newattrs.ia_mode &= ~S_ISGID;
newattrs.ia_valid |= ATTR_MODE;