diff options
author | Brian Foster <bfoster@redhat.com> | 2024-02-15 12:16:05 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-24 20:45:24 -0500 |
commit | b58b1b883b9b702e25204dbe2b221eecc8ecd159 (patch) | |
tree | ec7e945eedda13aba942254131514d41a4f9c173 /fs/ceph | |
parent | 204f45140faa0772d2ca1b3de96d1c0fb3db8e77 (diff) | |
download | linux-b58b1b883b9b702e25204dbe2b221eecc8ecd159.tar.gz linux-b58b1b883b9b702e25204dbe2b221eecc8ecd159.tar.bz2 linux-b58b1b883b9b702e25204dbe2b221eecc8ecd159.zip |
bcachefs: fix iov_iter count underflow on sub-block dio read
bch2_direct_IO_read() checks the request offset and size for sector
alignment and then falls through to a couple calculations to shrink
the size of the request based on the inode size. The problem is that
these checks round up to the fs block size, which runs the risk of
underflowing iter->count if the block size happens to be large
enough. This is triggered by fstest generic/361 with a 4k block
size, which subsequently leads to a crash. To avoid this crash,
check that the shorten length doesn't exceed the overall length of
the iter.
Fixes:
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Su Yue <glass.su@suse.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/ceph')
0 files changed, 0 insertions, 0 deletions