summaryrefslogtreecommitdiff
path: root/scripts/basic/Makefile
diff options
context:
space:
mode:
authorAristo Chen <[email protected]>2026-06-05 15:42:49 +0000
committerTom Rini <[email protected]>2026-06-17 12:47:33 -0600
commit914ebe8b16b40537c3b438bc213b738151018ec6 (patch)
treeddd2b1e5f10fee78e61622aed5ba0d07685b4451 /scripts/basic/Makefile
parentbc69d4e2840ac0faee560d76f2b27aa288864c42 (diff)
bootm: fix overflow of the noload kernel decompression buffer
For a compressed kernel_noload image, bootm_load_os() allocates a decompression buffer sized to ALIGN(image_len * 4, SZ_1M), assuming the kernel compresses by no more than a factor of four. It then passes CONFIG_SYS_BOOTM_LEN, rather than the size of that buffer, to image_decomp() as the output limit. The decompressors honour the limit they are given, so a kernel that decompresses to more than four times its compressed size is written past the end of the allocated buffer and corrupts adjacent memory. Pass the allocation size to image_decomp() and handle_decomp_error() so decompression stops at the buffer boundary and fails cleanly when the image is too large, instead of overflowing. The regular non-noload paths are unchanged and continue to use CONFIG_SYS_BOOTM_LEN. When the failure is triggered by the smaller per-image buffer, print a note so that handle_decomp_error()'s generic advice to increase CONFIG_SYS_BOOTM_LEN does not mislead the reader. Fixes: 69544c4fd8b1 ("bootm: Support kernel_noload with compression") Reviewed-by: Simon Glass <[email protected]> Signed-off-by: Aristo Chen <[email protected]>
Diffstat (limited to 'scripts/basic/Makefile')
0 files changed, 0 insertions, 0 deletions