Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4f6daac authored by Richard Weinberger's avatar Richard Weinberger
Browse files

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: default avatarRichard Weinberger <richard@nod.at>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent fc77dbd3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,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;