From: Miklos Szeredi Date: Tue, 11 Apr 2006 05:54:49 +0000 (-0700) Subject: [PATCH] fuse: fix oops in fuse_send_readpages() X-Git-Tag: firefly_0821_release~36250 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d3406ffa4af8af1d7c14cff06e003eb0a557d4ad;p=firefly-linux-kernel-4.4.55.git [PATCH] fuse: fix oops in fuse_send_readpages() During heavy parallel filesystem activity it was possible to Oops the kernel. The reason is that read_cache_pages() could skip pages which have already been inserted into the cache by another task. Occasionally this may result in zero pages actually being sent, while fuse_send_readpages() relies on at least one page being in the request. So check this corner case and just free the request instead of trying to send it. Reported and tested by Konstantin Isakov. Signed-off-by: Miklos Szeredi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 975f2697e866..3ac39c0288de 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -397,8 +397,12 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, return -EINTR; err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); - if (!err) - fuse_send_readpages(data.req, file, inode); + if (!err) { + if (data.req->num_pages) + fuse_send_readpages(data.req, file, inode); + else + fuse_put_request(fc, data.req); + } return err; }