]> git.baikalelectronics.ru Git - kernel.git/commit
fuse: honour max_read and max_write in direct_io mode
authorMiklos Szeredi <mszeredi@suse.cz>
Wed, 24 Sep 2014 15:09:11 +0000 (17:09 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 27 Sep 2014 01:16:51 +0000 (21:16 -0400)
commit7aacd3825216622a938def4024435a0693c753d2
treea43d1f9a9706d519a46c1b772b69c8996319961c
parent725659f3fbdacabeef52f9a2e38bb0643486161f
fuse: honour max_read and max_write in direct_io mode

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: 904c4c322826 ("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>
fs/direct-io.c
fs/fuse/file.c
include/linux/uio.h
mm/iov_iter.c