diff options
author | Michał Kępień <[email protected]> | 2021-11-30 12:31:49 +0100 |
---|---|---|
committer | Miquel Raynal <[email protected]> | 2021-12-09 17:52:29 +0100 |
commit | 6420ac0af95dbcb2fd8452e2d551ab50e1bbad83 (patch) | |
tree | 8c60fc35d095bb16a0daae2820a7813936363aea /tools/perf/scripts/python/syscall-counts-by-pid.py | |
parent | dd8a2e884a462c09a562f04927cb227e3cdaa498 (diff) |
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 <[email protected]>
Signed-off-by: Michał Kępień <[email protected]>
Signed-off-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/linux-mtd/[email protected]
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts-by-pid.py')
0 files changed, 0 insertions, 0 deletions