diff options
| author | Georgiy Osokin <g.osokin@auroraos.dev> | 2026-09-28 17:31:13 +0300 |
|---|---|---|
| committer | Jens Wiklander <jens.wiklander@oss.qualcomm.com> | 2026-10-02 13:58:48 +0200 |
| commit | b7f925fd5226deb953c8dcdc9677d3fcc2717c00 (patch) | |
| tree | 01ceea4b6496e3e159c2205703980e64be5eb27c /include | |
| parent | 8d3ae59288f1e7d58d76558a6ee96d533bc5019f (diff) | |
| download | linux-next-b7f925fd5226deb953c8dcdc9677d3fcc2717c00.tar.gz linux-next-b7f925fd5226deb953c8dcdc9677d3fcc2717c00.zip | |
tee: shm: reject zero-sized allocations in tee_dyn_shm_alloc_helper()
tee_dyn_shm_alloc_helper() derives nr_pages from a caller-supplied size
and passes it to alloc_pages_exact() without checking it. For size == 0
nr_pages is 0, and alloc_pages_exact(0) calls get_order(0), which is
documented as undefined and returns BITS_PER_LONG - PAGE_SHIFT. The page
allocator then trips its order > MAX_PAGE_ORDER warning and fails the
allocation; on a panic_on_warn kernel that ends the boot.
This can be triggered by TEE_IOC_SHM_ALLOC with struct
tee_ioctl_shm_alloc_data where size is 0.
Reject a zero page count, as register_shm_helper() already does for the
register path.
Fixes: cf4441503e20 ("tee: optee: Move pool_op helper functions")
Cc: stable@vger.kernel.org
Cc: lvc-project@linuxtesting.org
Signed-off-by: Georgiy Osokin <g.osokin@auroraos.dev>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@oss.qualcomm.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
