diff options
author | 2017-05-08 13:54:47 -0400 | |
---|---|---|
committer | 2017-05-08 13:54:47 -0400 | |
commit | 5b47d59af68a8735e4637bacedcb4baf6f47c73f (patch) | |
tree | ca26a750a251a2d70c9c3f1616aa58f0c1c3c46d /mm/filemap.c | |
parent | iov_iter: don't revert iov buffer if csum error (diff) | |
download | linux-5b47d59af68a8735e4637bacedcb4baf6f47c73f.tar.gz linux-5b47d59af68a8735e4637bacedcb4baf6f47c73f.tar.bz2 linux-5b47d59af68a8735e4637bacedcb4baf6f47c73f.zip |
fix braino in generic_file_read_iter()
Wrong sign of iov_iter_revert() argument. Unfortunately, slipped through
the testing, since most of the time we don't do anything to the iterator
afterwards and potential oops on walking the iter->iov too far backwards
is too infrequent to be easily triggered.
Add a sanity check in iov_iter_revert() to catch bugs like this one;
fortunately, the same braino hadn't happened in other callers, but we'd
better have a warning if such thing crops up.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index cc480c07c71b..d6e67be1802e 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2048,7 +2048,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) iocb->ki_pos += retval; count -= retval; } - iov_iter_revert(iter, iov_iter_count(iter) - count); + iov_iter_revert(iter, count - iov_iter_count(iter)); /* * Btrfs can have a short DIO read if we encounter |