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 15:46:17 +0000 (16:46 +0100)
commit6f63704838ff4958e91af089ab15fd688eeda190
tree0a0675968e5c4504138b7ffdc71e7879751c0fc9
parent6cc4ccdd0b975f5f4c334fac71fee47e564472bf
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