diff options
author | Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> | 2024-09-03 17:16:23 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2024-09-04 16:51:11 +0200 |
commit | 5b8ca5a54cb89ab07b0389f50e038e533cdfdd86 (patch) | |
tree | 07bd85107438931525a81c58abcb112f24b5aba6 /fs/fuse/file.c | |
parent | 4be75ffe721cbf925478ebfbff872b02833899b7 (diff) |
fuse: handle idmappings properly in ->write_iter()
This is needed to properly clear suid/sgid.
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r-- | fs/fuse/file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 0c33ddf97864..ca553d7a7c9e 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1398,6 +1398,7 @@ static void fuse_dio_unlock(struct kiocb *iocb, bool exclusive) static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from) { struct file *file = iocb->ki_filp; + struct mnt_idmap *idmap = file_mnt_idmap(file); struct address_space *mapping = file->f_mapping; ssize_t written = 0; struct inode *inode = mapping->host; @@ -1412,7 +1413,7 @@ static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from) return err; if (fc->handle_killpriv_v2 && - setattr_should_drop_suidgid(&nop_mnt_idmap, + setattr_should_drop_suidgid(idmap, file_inode(file))) { goto writethrough; } |