summaryrefslogtreecommitdiffstats
path: root/fs/direct-io.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-09-24 17:09:11 +0200
committerLuis Henriques <luis.henriques@canonical.com>2014-11-03 10:46:27 +0000
commitad0f3236b95c392787cb8555aea5ee1c4d84f01e (patch)
treeee84311fbbb19a5b9fbed60b1562b77da52f8395 /fs/direct-io.c
parent88157ce345bf86dc8bb3038683c8a619146bc66e (diff)
downloadlinux-stable-ad0f3236b95c392787cb8555aea5ee1c4d84f01e.tar.gz
linux-stable-ad0f3236b95c392787cb8555aea5ee1c4d84f01e.tar.bz2
linux-stable-ad0f3236b95c392787cb8555aea5ee1c4d84f01e.zip
fuse: honour max_read and max_write in direct_io mode
commit 2c80929c4c4d54e568b07ab85877d5fd38f4b02f upstream. The third argument of fuse_get_user_pages() "nbytesp" refers to the number of bytes a caller asked to pack into fuse request. This value may be lesser than capacity of fuse request or iov_iter. So fuse_get_user_pages() must ensure that *nbytesp won't grow. Now, when helper iov_iter_get_pages() performs all hard work of extracting pages from iov_iter, it can be done by passing properly calculated "maxsize" to the helper. The other caller of iov_iter_get_pages() (dio_refill_pages()) doesn't need this capability, so pass LONG_MAX as the maxsize argument here. Fixes: c9c37e2e6378 ("fuse: switch to iov_iter_get_pages()") Reported-by: Werner Baumann <werner.baumann@onlinehome.de> Tested-by: Maxim Patlasov <mpatlasov@parallels.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'fs/direct-io.c')
-rw-r--r--fs/direct-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/direct-io.c b/fs/direct-io.c
index c3116404ab49..e181b6b2e297 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -158,7 +158,7 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio)
{
ssize_t ret;
- ret = iov_iter_get_pages(sdio->iter, dio->pages, DIO_PAGES,
+ ret = iov_iter_get_pages(sdio->iter, dio->pages, LONG_MAX, DIO_PAGES,
&sdio->from);
if (ret < 0 && sdio->blocks_available && (dio->rw & WRITE)) {