aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2015-05-21 16:05:52 +0200
committerSasha Levin <sasha.levin@oracle.com>2015-07-13 08:50:03 -0400
commitdf93988e8b5cd9fe6b1b73c5da668d7e0ca018a4 (patch)
tree67f625116dd2788127ae4dd1bf0cf5586de37ac3 /fs
parentc215cf258214858a5a6c3e63cd7ee78b92d210b2 (diff)
fs: Fix S_NOSEC handling
[ Upstream commit 2426f3910069ed47c0cc58559a6d088af7920201 ] file_remove_suid() could mistakenly set S_NOSEC inode bit when root was modifying the file. As a result following writes to the file by ordinary user would avoid clearing suid or sgid bits. Fix the bug by checking actual mode bits before setting S_NOSEC. CC: stable@vger.kernel.org Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 26753ba7b6d6..56d1d2b4bf31 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1631,8 +1631,8 @@ int file_remove_suid(struct file *file)
error = security_inode_killpriv(dentry);
if (!error && killsuid)
error = __remove_suid(dentry, killsuid);
- if (!error && (inode->i_sb->s_flags & MS_NOSEC))
- inode->i_flags |= S_NOSEC;
+ if (!error)
+ inode_has_no_xattr(inode);
return error;
}