diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-07 11:45:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-07 11:45:23 -0500 |
commit | ce779d6b5bbe6a32452a882605d09518cc79e4ba (patch) | |
tree | 2d8ffb9daaf118e2561cdc73ffa5e5684d91b235 | |
parent | f27c2f69cc8edc03ea8086f974811b9b45b2f3a5 (diff) | |
parent | c01638f5d919728f565bf8b5e0a6a159642df0d9 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse fix from Miklos Szeredi:
"Fix a regression spotted by Jeff Layton"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
fuse: fix clearing suid, sgid for chown()
-rw-r--r-- | fs/fuse/dir.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index b3ebe512d64c..096f79997f75 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1739,8 +1739,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) | |||
1739 | * This should be done on write(), truncate() and chown(). | 1739 | * This should be done on write(), truncate() and chown(). |
1740 | */ | 1740 | */ |
1741 | if (!fc->handle_killpriv) { | 1741 | if (!fc->handle_killpriv) { |
1742 | int kill; | ||
1743 | |||
1744 | /* | 1742 | /* |
1745 | * ia_mode calculation may have used stale i_mode. | 1743 | * ia_mode calculation may have used stale i_mode. |
1746 | * Refresh and recalculate. | 1744 | * Refresh and recalculate. |
@@ -1750,12 +1748,11 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr) | |||
1750 | return ret; | 1748 | return ret; |
1751 | 1749 | ||
1752 | attr->ia_mode = inode->i_mode; | 1750 | attr->ia_mode = inode->i_mode; |
1753 | kill = should_remove_suid(entry); | 1751 | if (inode->i_mode & S_ISUID) { |
1754 | if (kill & ATTR_KILL_SUID) { | ||
1755 | attr->ia_valid |= ATTR_MODE; | 1752 | attr->ia_valid |= ATTR_MODE; |
1756 | attr->ia_mode &= ~S_ISUID; | 1753 | attr->ia_mode &= ~S_ISUID; |
1757 | } | 1754 | } |
1758 | if (kill & ATTR_KILL_SGID) { | 1755 | if ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { |
1759 | attr->ia_valid |= ATTR_MODE; | 1756 | attr->ia_valid |= ATTR_MODE; |
1760 | attr->ia_mode &= ~S_ISGID; | 1757 | attr->ia_mode &= ~S_ISGID; |
1761 | } | 1758 | } |