]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 9 Nov 2018 19:00:06 +0000 (17:00 -0200)
commit0e522047cc1b8886fa428c7522c5f3843bb57a3f
treed53198acb502f80a2d846968b9f54cd43f5ec7a2
parent1677b200cd041d558c48b7a313c22786c130fc63
ext4: fix hole length detection in ext4_ind_map_blocks()

BugLink: http://bugs.launchpad.net/bugs/1800537
commit 2ee3ee06a8fd792765fa3267ddf928997797eec5 upstream.

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: facab4d9711e7aa3532cb82643803e8f1b9518e8
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/ext4/indirect.c