UBI: Validate data_size
authorRichard Weinberger <richard@nod.at>
Tue, 22 Sep 2015 21:58:07 +0000 (23:58 +0200)
committerZefan Li <lizefan@huawei.com>
Wed, 27 Apr 2016 10:55:25 +0000 (18:55 +0800)
commit15acb368e63874fbb7b34d424185921e9a8dc996
tree8ca26e2f9746e952d8a60a832cc2e2608ffe190b
parent9ed559d3d6fd06cb3a20e120f8b55be46c8d33db
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>
[lizf: Backported to 3.4: use dbg_err() instead of ubi_err()];
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/mtd/ubi/io.c