summaryrefslogtreecommitdiff
path: root/drivers/scsi/3w-9xxx.c
diff options
context:
space:
mode:
authorMichał Kępień <kernel@kempniu.pl>2021-11-30 14:31:49 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2021-12-09 19:52:29 +0300
commit6420ac0af95dbcb2fd8452e2d551ab50e1bbad83 (patch)
tree8c60fc35d095bb16a0daae2820a7813936363aea /drivers/scsi/3w-9xxx.c
parentdd8a2e884a462c09a562f04927cb227e3cdaa498 (diff)
downloadlinux-6420ac0af95dbcb2fd8452e2d551ab50e1bbad83.tar.xz
mtdchar: prevent unbounded allocation in MEMWRITE ioctl
In the mtdchar_write_ioctl() function, memdup_user() is called with its 'len' parameter set to verbatim values provided by user space via a struct mtd_write_req. Both the 'len' and 'ooblen' fields of that structure are 64-bit unsigned integers, which means the MEMWRITE ioctl can trigger unbounded kernel memory allocation requests. Fix by iterating over the buffers provided by user space in a loop, processing at most mtd->erasesize bytes in each iteration. Adopt some checks from mtd_check_oob_ops() to retain backward user space compatibility. Suggested-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Michał Kępień <kernel@kempniu.pl> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20211130113149.21848-1-kernel@kempniu.pl
Diffstat (limited to 'drivers/scsi/3w-9xxx.c')
0 files changed, 0 insertions, 0 deletions