diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 20:45:25 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-06 09:40:13 (GMT) |
commit | 48466c4772d2cfeb331395043f7edd8c5324ef1b (patch) | |
tree | 4f6fdfd81fbb7210d490f9a758505fe33cc857a3 /net/ipv6/fou6.c | |
parent | 694a95fa6dae4991f16cda333d897ea063021fed (diff) | |
download | linux-48466c4772d2cfeb331395043f7edd8c5324ef1b.tar.xz |
vfs,mm: fix return value of read() at s_maxbytes
commit d05c5f7ba164aed3db02fb188c26d0dd94f5455b upstream.
We truncated the possible read iterator to s_maxbytes in commit
c2a9737f45e2 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()"),
but our end condition handling was wrong: it's not an error to try to
read at the end of the file.
Reading past the end should return EOF (0), not EINVAL.
See for example
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1649342
http://lists.gnu.org/archive/html/bug-coreutils/2016-12/msg00008.html
where a md5sum of a maximally sized file fails because the final read is
exactly at s_maxbytes.
Fixes: c2a9737f45e2 ("vfs,mm: fix a dead loop in truncate_inode_pages_range()")
Reported-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: Wei Fang <fangwei1@huawei.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv6/fou6.c')
0 files changed, 0 insertions, 0 deletions