[PATCH 17/62] UBI: fix out of bounds write

Teresa Remmet t.remmet at phytec.de
Mon May 23 01:26:05 PDT 2016


From: Brian Norris <computersforpeace at gmail.com>

If aeb->len >= vol->reserved_pebs, we should not be writing aeb into the
PEB->LEB mapping.

Caught by Coverity, CID #711212.

Cc: stable <stable at vger.kernel.org>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Signed-off-by: Richard Weinberger <richard at nod.at>
---
 drivers/mtd/ubi/eba.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 1dbf126..bb89d10 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -1306,7 +1306,8 @@ int ubi_eba_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
 				 * during re-size.
 				 */
 				ubi_move_aeb_to_list(av, aeb, &ai->erase);
-			vol->eba_tbl[aeb->lnum] = aeb->pnum;
+			else
+				vol->eba_tbl[aeb->lnum] = aeb->pnum;
 		}
 	}
 
-- 
1.9.1




More information about the barebox mailing list