Skip to content

Commit ce779d6

Browse files
committed
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()
2 parents f27c2f6 + c01638f commit ce779d6

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

fs/fuse/dir.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,8 +1739,6 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
17391739
* This should be done on write(), truncate() and chown().
17401740
*/
17411741
if (!fc->handle_killpriv) {
1742-
int kill;
1743-
17441742
/*
17451743
* ia_mode calculation may have used stale i_mode.
17461744
* Refresh and recalculate.
@@ -1750,12 +1748,11 @@ static int fuse_setattr(struct dentry *entry, struct iattr *attr)
17501748
return ret;
17511749

17521750
attr->ia_mode = inode->i_mode;
1753-
kill = should_remove_suid(entry);
1754-
if (kill & ATTR_KILL_SUID) {
1751+
if (inode->i_mode & S_ISUID) {
17551752
attr->ia_valid |= ATTR_MODE;
17561753
attr->ia_mode &= ~S_ISUID;
17571754
}
1758-
if (kill & ATTR_KILL_SGID) {
1755+
if ((inode->i_mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
17591756
attr->ia_valid |= ATTR_MODE;
17601757
attr->ia_mode &= ~S_ISGID;
17611758
}

0 commit comments

Comments
 (0)