Skip to contentSkip to conversation

Patch "UBI: Validate data_size" has been added to the 4.2-stable tree

PATCH [email protected] 1 participant 1 message Oct 17, 2015

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

UBI: Validate data_size

to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ubi-validate-data_size.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 281fda27673f833a01d516658a64d22a32c8e072 Mon Sep 17 00:00:00 2001

From: Richard Weinberger <[email protected]>
Date: Tue, 22 Sep 2015 23:58:07 +0200
Subject: UBI: Validate data_size

From: Richard Weinberger <[email protected]>

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().

---
 drivers/mtd/ubi/io.c |    5 +++++
 1 file changed, 5 insertions(+)
drivers/mtd/ubi/io.c +5 -0
@@ -926,6 +926,11 @@ static int validate_vid_hdr(const struct
 		goto bad;
 	}
 
+	if (data_size > ubi->leb_size) {
+		ubi_err(ubi, "bad data_size");
+		goto bad;
+	}
+
 	if (vol_type == UBI_VID_STATIC) {
 		/*
 		 * Although from high-level point of view static volumes may

Patches currently in stable-queue which might be from [email protected] are

queue-4.2/ubifs-kill-unneeded-locking-in-ubifs_init_security.patch queue-4.2/ubi-validate-data_size.patch queue-4.2/ubi-return-enospc-if-no-enough-space-available.patch