aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds2017-05-09 11:01:21 -0500
committerLinus Torvalds2017-05-09 11:01:21 -0500
commit339fbf6796f8e74544091adbf511286768eaf93e (patch)
tree12840783d0eb70d1a7ecd13c3a7fab5b69b0a2b6
parent8ee74a91ac304ad2e9e794eb96ed76f0634dec40 (diff)
parent5b47d59af68a8735e4637bacedcb4baf6f47c73f (diff)
downloadkernel-339fbf6796f8e74544091adbf511286768eaf93e.tar.gz
kernel-339fbf6796f8e74544091adbf511286768eaf93e.tar.xz
kernel-339fbf6796f8e74544091adbf511286768eaf93e.zip
Merge branch 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs fix from Al Viro: "Braino fix for iov_iter_revert() misuse" * 'work.iov_iter' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fix braino in generic_file_read_iter()
-rw-r--r--lib/iov_iter.c2
-rw-r--r--mm/filemap.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index ae82d9cea553..f835964c9485 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -790,6 +790,8 @@ void iov_iter_revert(struct iov_iter *i, size_t unroll)
790{ 790{
791 if (!unroll) 791 if (!unroll)
792 return; 792 return;
793 if (WARN_ON(unroll > MAX_RW_COUNT))
794 return;
793 i->count += unroll; 795 i->count += unroll;
794 if (unlikely(i->type & ITER_PIPE)) { 796 if (unlikely(i->type & ITER_PIPE)) {
795 struct pipe_inode_info *pipe = i->pipe; 797 struct pipe_inode_info *pipe = i->pipe;
diff --git a/mm/filemap.c b/mm/filemap.c
index b7b973b47d8d..6f1be573a5e6 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2050,7 +2050,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
2050 iocb->ki_pos += retval; 2050 iocb->ki_pos += retval;
2051 count -= retval; 2051 count -= retval;
2052 } 2052 }
2053 iov_iter_revert(iter, iov_iter_count(iter) - count); 2053 iov_iter_revert(iter, count - iov_iter_count(iter));
2054 2054
2055 /* 2055 /*
2056 * Btrfs can have a short DIO read if we encounter 2056 * Btrfs can have a short DIO read if we encounter