]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix hole length detection in ext4_ind_map_blocks()
authorJan Kara <jack@suse.cz>
Sat, 12 May 2018 23:55:00 +0000 (19:55 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 12 May 2018 23:55:00 +0000 (19:55 -0400)
commitc4b4b3fba866764f5846fc15551a84b66937c5f1
tree5840ba188731252ce6ffdec612d59ea709537b86
parent8cbbc910ab4d887b51cd8064df17d6e3650db65a
ext4: fix hole length detection in ext4_ind_map_blocks()

When ext4_ind_map_blocks() computes a length of a hole, it doesn't count
with the fact that mapped offset may be somewhere in the middle of the
completely empty subtree. In such case it will return too large length
of the hole which then results in lseek(SEEK_DATA) to end up returning
an incorrect offset beyond the end of the hole.

Fix the problem by correctly taking offset within a subtree into account
when computing a length of a hole.

Fixes: 52252a0ec7ff61466403e717258e31a0d94a416a
CC: stable@vger.kernel.org
Reported-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/indirect.c