udf: Detect incorrect directory size
authorJan Kara <jack@suse.cz>
Wed, 13 Jun 2018 10:09:22 +0000 (12:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jul 2018 09:25:03 +0000 (11:25 +0200)
commit1b241aa840df5c7af16eb1ad0b614a372a639caa
tree5b0c8d863a1b5ae4f61039d978160d3556871614
parentd08dfdeaf49d240674fff55189a0d8349aeb0858
udf: Detect incorrect directory size

commit fa65653e575fbd958bdf5fb9c4a71a324e39510d upstream.

Detect when a directory entry is (possibly partially) beyond directory
size and return EIO in that case since it means the filesystem is
corrupted. Otherwise directory operations can further corrupt the
directory and possibly also oops the kernel.

CC: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
CC: stable@vger.kernel.org
Reported-and-tested-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/udf/directory.c