diff options
author | Al Viro <[email protected]> | 2014-06-23 08:44:40 +0100 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2014-06-26 13:02:28 -0700 |
commit | 0b86dbf675e0170a191a9ca18e5e99fd39a678c0 (patch) | |
tree | a135b6259c00d624188e83c1324404e21a433f64 /fs/jbd2/commit.c | |
parent | d7933ab727ed035bdf420d7381b831ba959cecc5 (diff) |
Fix 32-bit regression in block device read(2)
blkdev_read_iter() wants to cap the iov_iter by the amount of data
remaining to the end of device. That's what iov_iter_truncate() is for
(trim iter->count if it's above the given limit). So far, so good, but
the argument of iov_iter_truncate() is size_t, so on 32bit boxen (in
case of a large device) we end up with that upper limit truncated down
to 32 bits *before* comparing it with iter->count.
Easily fixed by making iov_iter_truncate() take 64bit argument - it does
the right thing after such change (we only reach the assignment in there
when the current value of iter->count is greater than the limit, i.e.
for anything that would get truncated we don't reach the assignment at
all) and that argument is not the new value of iter->count - it's an
upper limit for such.
The overhead of passing u64 is not an issue - the thing is inlined, so
callers passing size_t won't pay any penalty.
Reported-and-tested-by: Theodore Tso <[email protected]>
Signed-off-by: Al Viro <[email protected]>
Tested-by: Alan Cox <[email protected]>
Tested-by: Bruno Wolff III <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'fs/jbd2/commit.c')
0 files changed, 0 insertions, 0 deletions