Commit a5bae33a authored by Richard Weinberger's avatar Richard Weinberger Committed by Greg Kroah-Hartman

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: default avatarRichard Weinberger <>
Reviewed-by: default avatarDavid Gstir <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 892e053c
......@@ -931,6 +931,11 @@ static int validate_vid_hdr(const struct ubi_device *ubi,
goto bad;
if (data_size > ubi->leb_size) {
ubi_err("bad data_size");
goto bad;
if (vol_type == UBI_VID_STATIC) {
* Although from high-level point of view static volumes may
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment