ext4: check for directory entries too close to block end
authorJan Kara <jack@suse.cz>
Mon, 2 Dec 2019 17:02:13 +0000 (18:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Dec 2019 11:38:00 +0000 (12:38 +0100)
commitd3c6b57dcb7b5e500a7e9e1078530ace567014eb
treeaa2af0af5315de80d3e818917d456deee2c436c8
parent11755d82e1adeb898976f3fb48ed6c8c67a9ed45
ext4: check for directory entries too close to block end

commit 109ba779d6cca2d519c5dd624a3276d03e21948e upstream.

ext4_check_dir_entry() currently does not catch a case when a directory
entry ends so close to the block end that the header of the next
directory entry would not fit in the remaining space. This can lead to
directory iteration code trying to access address beyond end of current
buffer head leading to oops.

CC: stable@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191202170213.4761-3-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/dir.c