diff options
| author | Weibin Liu <liuwb@xiaopeng.com> | 2026-09-29 16:11:45 +0800 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-14 16:43:39 +0100 |
| commit | ef9690269999ddf9b204731baca1bd6b7aea1aa7 (patch) | |
| tree | 6fb72358f657de84ce40851230bc2bd9edf95542 /tools/perf/scripts/python | |
| parent | ea9854a169e9c1437df8829bea21c2f2e80b137c (diff) | |
spi: cadence-xspi: fix stack buffer overflow in the Marvell b0 path
transfer_one_message_b0() falls back to a 10-byte stack buffer for
transfers which carry no TX data and points both in_buffer and
out_buffer into it.
With a transfer longer than 10 bytes the SDMA branch of the loop moves
up to MRVL_XFER_QWORD_COUNT * MRVL_XFER_QWORD_BYTECOUNT (256) bytes
through those pointers and then advances them by the same amount, so
both directions overflow the scratch buffer: a read transaction copies
SDMA data past the end of the buffer, a write transaction sends stack
contents from beyond it to the SPI bus.
Size the scratch buffer for the largest chunk the loop can request,
keep the buffer pointers pinned to it when the message does not carry
the corresponding TX or RX data, and only advance the pointers which
reference real transfer buffers. Also zero-initialize the scratch
buffer so that padding bytes sent for TX-less transfers no longer leak
uninitialized stack contents.
Fixes: 5cb7651f78e1 ("Marvell HW overlay support for Cadence xSPI")
Cc: stable@vger.kernel.org # 6.11+
Signed-off-by: Weibin Liu <liuwb@xiaopeng.com>
Link: https://patch.msgid.link/20260929081146.41041-3-liuwb@xiaopeng.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
