aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2016-10-11 13:21:14 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-10-11 13:40:01 -0400
commit1689c73a739d094b544c680b0dfdebe52ffee8fb (patch)
tree5a45d8a901398a27c3142e962a97865304e74f16 /lib
parent6b5e09a748ad0a0b198d0e268c7e689044bfe48a (diff)
Fix off-by-one in __pipe_get_pages()
it actually worked only when requested area ended on the page boundary... Reported-by: Marco Grassi <marco.gra@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/iov_iter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 0ce341125195..7312e7784611 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -833,13 +833,13 @@ static inline size_t __pipe_get_pages(struct iov_iter *i,
833 size_t *start) 833 size_t *start)
834{ 834{
835 struct pipe_inode_info *pipe = i->pipe; 835 struct pipe_inode_info *pipe = i->pipe;
836 size_t n = push_pipe(i, maxsize, &idx, start); 836 ssize_t n = push_pipe(i, maxsize, &idx, start);
837 if (!n) 837 if (!n)
838 return -EFAULT; 838 return -EFAULT;
839 839
840 maxsize = n; 840 maxsize = n;
841 n += *start; 841 n += *start;
842 while (n >= PAGE_SIZE) { 842 while (n > 0) {
843 get_page(*pages++ = pipe->bufs[idx].page); 843 get_page(*pages++ = pipe->bufs[idx].page);
844 idx = next_idx(idx, pipe); 844 idx = next_idx(idx, pipe);
845 n -= PAGE_SIZE; 845 n -= PAGE_SIZE;