diff options
author | Richard Weinberger <richard@nod.at> | 2016-05-27 09:44:54 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-05-27 12:30:27 +0200 |
commit | 58eb46f7cb62bc533d9f80145e4a850adaa7f64b (patch) | |
tree | 8e083ac77b7513da973a6b1aefcb0e674938f90d /drivers/mtd | |
parent | 70270111065f3ffed805272795cdc77d4e674351 (diff) | |
download | barebox-58eb46f7cb62bc533d9f80145e4a850adaa7f64b.tar.gz barebox-58eb46f7cb62bc533d9f80145e4a850adaa7f64b.tar.xz |
ubi: Fix out of bounds write in volume update code
ubi_start_leb_change() allocates too few bytes.
ubi_more_leb_change_data() will write up to req->upd_bytes +
ubi->min_io_size bytes.
Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/upd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c index 5e067534ce..33d4dbf0bd 100644 --- a/drivers/mtd/ubi/upd.c +++ b/drivers/mtd/ubi/upd.c @@ -201,7 +201,7 @@ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol, vol->changing_leb = 1; vol->ch_lnum = req->lnum; - vol->upd_buf = vmalloc(req->bytes); + vol->upd_buf = vmalloc(ALIGN((int)req->bytes, ubi->min_io_size)); if (!vol->upd_buf) return -ENOMEM; |