fuse: verify write return
authorMiklos Szeredi <mszeredi@redhat.com>
Tue, 12 Nov 2019 10:49:04 +0000 (11:49 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 12 Nov 2019 10:49:04 +0000 (11:49 +0100)
Make sure filesystem is not returning a bogus number of bytes written.

Fixes: ea9b9907b82a ("fuse: implement perform_write")
Cc: <stable@vger.kernel.org> # v2.6.26
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/file.c

index db48a5c..795d0f2 100644 (file)
@@ -1096,6 +1096,8 @@ static ssize_t fuse_send_write_pages(struct fuse_io_args *ia,
        ia->write.in.flags = fuse_write_flags(iocb);
 
        err = fuse_simple_request(fc, &ap->args);
+       if (!err && ia->write.out.size > count)
+               err = -EIO;
 
        offset = ap->descs[0].offset;
        count = ia->write.out.size;