]> git.baikalelectronics.ru Git - kernel.git/commit
fuse: fix killing s[ug]id in setattr
authorMiklos Szeredi <mszeredi@redhat.com>
Sat, 1 Oct 2016 05:32:32 +0000 (07:32 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Sat, 1 Oct 2016 05:32:32 +0000 (07:32 +0200)
commitb3ceee1af3b2e7aa2dd0ec7c3a1dbb7524307d27
treee232e770852cba1b8e339aebf9d6f37362304070
parentf14be30a0c3be5a71f66f0a883cd443375b2fd1f
fuse: fix killing s[ug]id in setattr

Fuse allowed VFS to set mode in setattr in order to clear suid/sgid on
chown and truncate, and (since writeback_cache) write.  The problem with
this is that it'll potentially restore a stale mode.

The poper fix would be to let the filesystems do the suid/sgid clearing on
the relevant operations.  Possibly some are already doing it but there's no
way we can detect this.

So fix this by refreshing and recalculating the mode.  Do this only if
ATTR_KILL_S[UG]ID is set to not destroy performance for writes.  This is
still racy but the size of the window is reduced.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
fs/fuse/dir.c