UBI: Validate data_size
authorRichard Weinberger <richard@nod.at>
Tue, 22 Sep 2015 21:58:07 +0000 (23:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:37:52 +0000 (14:37 -0700)
commita5bae33a3530cdfa59e86899e06e4213372b2bce
tree044a04e2a8a191af9ef4ac6c0e4bd254b5dd8e46
parent892e053cd7afcc54b2958130cab94ee2123be2d7
UBI: Validate data_size

commit 281fda27673f833a01d516658a64d22a32c8e072 upstream.

Make sure that data_size is less than LEB size.
Otherwise a handcrafted UBI image is able to trigger
an out of bounds memory access in ubi_compare_lebs().

Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: David Gstir <david@sigma-star.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/ubi/io.c