diff options
| author | Atul Akella <atul.akella@gmail.com> | 2026-10-05 11:25:18 +0000 |
|---|---|---|
| committer | Mathieu Poirier <mathieu.poirier@linaro.org> | 2026-11-02 11:23:18 -0600 |
| commit | cf3d1097cbdb84650be45ea6cbd05c8898509cc9 (patch) | |
| tree | 3e1b57b828e88d44584542e2fb4a6d6682ddfd53 /scripts/Makefile.thinlto | |
| parent | 695aa66b8e278af935b98a2dca5b5b9f10a71eb9 (diff) | |
| download | linux-next-cf3d1097cbdb84650be45ea6cbd05c8898509cc9.tar.gz linux-next-cf3d1097cbdb84650be45ea6cbd05c8898509cc9.zip | |
remoteproc: mtk_scp: Fix bounds check in mt8192_scp_da_to_va()
mt8192_scp_da_to_va() translates a device address to a pointer into
SCP SRAM, L1TCM or DRAM. Its bounds checks have two problems:
- (da + len) is computed in u64 and wraps for a large da or len.
With da = 0xfffffffffffffff0 and len = 0x20, the sum is 0x10 and
passes "<= base + size" while da >= base also holds.
- offset is an int but is assigned from a u64 difference, so it is
truncated before being added to the region's base pointer.
da and len come from the firmware's ELF program headers
(p_paddr/p_memsz) via rproc_da_to_va(), and the returned pointer is
then written to by the ELF loader, so a malformed firmware image can
make the loader write outside the intended region.
Use a u64 offset and compare len against the remaining region size
instead of adding it to da. Apply this to the SRAM, L1TCM and DRAM
regions.
Fixes: ca23ecfdbd44 ("remoteproc/mediatek: support L1TCM")
Cc: stable@vger.kernel.org
Signed-off-by: Atul Akella <atul.akella@gmail.com>
Link: https://lore.kernel.org/r/bc3f565d08f6948aed9172c01c7c38b4cafa2ec1.1791198233.git.atul.akella@gmail.com
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
