Re: [PATCH 03/10] nvmem: sprd: Avoid out-of-bounds read on partial writes in sprd_efuse_raw_prog()
From: Baolin Wang
Date: Thu Dec 03 2026 - 20:27:32 EST
On 12/3/26 4:26 PM, Lee Jones wrote:
sprd_efuse_write() allows partial-block writes smaller than
SPRD_EFUSE_BLOCK_WIDTH (4 bytes) because the device registers with
word_size and stride set to 1. Passing val directly to
sprd_efuse_raw_prog() as u32 * and dereferencing *data performs a 4-byte
out-of-bounds heap read past short buffers and burns slab contents into
hardware eFuses, while writes larger than 4 bytes are silently
truncated.
Validate that bytes is in [1, SPRD_EFUSE_BLOCK_WIDTH], copy bytes into a
zero-initialised __le32 local variable, and pass the converted u32 value
to sprd_efuse_raw_prog() by value.
Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")
Closes: https://sashiko.dev/#/bug/linux-7e0bb49f-4129-4a8d-a023-a0dbab6773f6
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
Thanks. LGTM.
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>