1 ext4: in ext4_seek_{hole,data}, return -ENXIO for negative offsets
3 From: "Darrick J. Wong" <darrick.wong@oracle.com>
5 In the ext4 implementations of SEEK_HOLE and SEEK_DATA, make sure we
6 return -ENXIO for negative offsets instead of banging around inside
7 the extent code and returning -EFSCORRUPTED.
9 Reported-by: Mateusz S <muttdini@gmail.com>
10 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
11 Cc: stable@vger.kernel.org # 4.6
13 fs/ext4/file.c | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
16 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
17 index 02ce7e7..923e765 100644
20 @@ -576,7 +576,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
23 isize = i_size_read(inode);
24 - if (offset >= isize) {
25 + if (offset < 0 || offset >= isize) {
29 @@ -639,7 +639,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
32 isize = i_size_read(inode);
33 - if (offset >= isize) {
34 + if (offset < 0 || offset >= isize) {