block/raw-posix: Abort on pread beyond end of non-growable file
authorKevin Wolf <kwolf@redhat.com>
Fri, 22 Jan 2010 13:26:38 +0000 (14:26 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 26 Jan 2010 22:41:07 +0000 (16:41 -0600)
commitcff3d73564676b4560d7452cf2cf11bb6e1b93da
tree0796fd4464b02dadafc2a3ce0e21dcdb35172cf9
parent0e97ba6848428c7719e2bd3df724728e4e5265c5
block/raw-posix: Abort on pread beyond end of non-growable file

This shouldn't happen under any normal circumstances. However, it looks like
it's possible to achieve this with corrupted images. Without this patch
raw_pread is hanging in an endless loop in such cases.

The patch is not affecting growable files, for which such reads happen in
normal use cases. raw_pread_aligned already handles these cases and won't
return zero in the first place.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/raw-posix.c