diff options
| author | Denis Arefev <arefev@swemel.ru> | 2026-10-14 13:26:18 +0300 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-10-14 14:38:31 +0200 |
| commit | fd65108f5001ffb416dc9bd37ec1893f55cff24a (patch) | |
| tree | 4ad48155f7fffdf7d831e67d193e3a9579b3ea3a /tools/lib/python/kdoc | |
| parent | 9e4b51e048d2c402ae8954080bc45576d23a20dd (diff) | |
ALSA: cs46xx: fix unit mismatch in DSP code area bounds check
ins->code.offset and code->size are measured in 32-bit words, while
DSP_CODE_BYTE_SIZE is the size of the DSP code area in bytes. The
check ins->code.offset + code->size > DSP_CODE_BYTE_SIZE in
cs46xx_dsp_load_module() therefore allowed up to four times more code
than the code area can hold.
The shadow buffer ins->code.data is allocated with
kmalloc(DSP_CODE_BYTE_SIZE), i.e. it holds DSP_CODE_BYTE_SIZE/4
words. A firmware file with a code segment larger than
DSP_CODE_BYTE_SIZE/4 words (28 KiB) passed the check and caused an
out-of-bounds write in shadow_and_reallocate_code() and an
out-of-bounds read in snd_cs46xx_download().
Compare the sum in words against DSP_CODE_BYTE_SIZE/4 and cast it to
u64 so that the sum cannot wrap for large code->size values.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Arefev <arefev@swemel.ru>
Link: https://patch.msgid.link/20261014102619.16415-1-arefev@swemel.ru
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions
