Skip to content

Commit e4f6daa

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: Richard Weinberger <richard@nod.at> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
1 parent fc77dbd commit e4f6daa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/ubi/upd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ int ubi_start_leb_change(struct ubi_device *ubi, struct ubi_volume *vol,
193193
vol->changing_leb = 1;
194194
vol->ch_lnum = req->lnum;
195195

196-
vol->upd_buf = vmalloc(req->bytes);
196+
vol->upd_buf = vmalloc(ALIGN((int)req->bytes, ubi->min_io_size));
197197
if (!vol->upd_buf)
198198
return -ENOMEM;
199199

0 commit comments

Comments
 (0)