Commit d3406ffa authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Linus Torvalds

[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: default avatarMiklos Szeredi <miklos@szeredi.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3e16f6af
...@@ -397,8 +397,12 @@ static int fuse_readpages(struct file *file, struct address_space *mapping, ...@@ -397,8 +397,12 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
return -EINTR; return -EINTR;
err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data); err = read_cache_pages(mapping, pages, fuse_readpages_fill, &data);
if (!err) if (!err) {
fuse_send_readpages(data.req, file, inode); if (data.req->num_pages)
fuse_send_readpages(data.req, file, inode);
else
fuse_put_request(fc, data.req);
}
return err; return err;
} }
......
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