Commit 5b8ca5a5 authored by Alexander Mikhalitsyn's avatar Alexander Mikhalitsyn Committed by Miklos Szeredi

fuse: handle idmappings properly in ->write_iter()

This is needed to properly clear suid/sgid.
Signed-off-by: default avatarAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 4be75ffe
...@@ -1398,6 +1398,7 @@ static void fuse_dio_unlock(struct kiocb *iocb, bool exclusive) ...@@ -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) static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from)
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct mnt_idmap *idmap = file_mnt_idmap(file);
struct address_space *mapping = file->f_mapping; struct address_space *mapping = file->f_mapping;
ssize_t written = 0; ssize_t written = 0;
struct inode *inode = mapping->host; struct inode *inode = mapping->host;
...@@ -1412,7 +1413,7 @@ static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from) ...@@ -1412,7 +1413,7 @@ static ssize_t fuse_cache_write_iter(struct kiocb *iocb, struct iov_iter *from)
return err; return err;
if (fc->handle_killpriv_v2 && if (fc->handle_killpriv_v2 &&
setattr_should_drop_suidgid(&nop_mnt_idmap, setattr_should_drop_suidgid(idmap,
file_inode(file))) { file_inode(file))) {
goto writethrough; goto writethrough;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment