UBI: fix out of bounds write

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@vger.kernel.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Brian Norris 2015-02-28 02:23:26 -08:00 committed by Richard Weinberger
parent 8eef7d70f7
commit d74adbdb9a
1 changed files with 2 additions and 1 deletions

View File

@ -1419,6 +1419,7 @@ 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);
else
vol->eba_tbl[aeb->lnum] = aeb->pnum;
}
}