From: Weibin Liu <liuwb@xiaopeng.com>
To: broonie@kernel.org
Cc: pthombar@cadence.com, wsadowski@marvell.com,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] spi: cadence-xspi: two memory-safety fixes in the slave-DMA paths
Date: Tue, 29 Sep 2026 16:11:43 +0800 [thread overview]
Message-ID: <20260929081146.41041-1-liuwb@xiaopeng.com> (raw)
While reviewing the slave-DMA handling of the Cadence XSPI driver I
found two ways in which memory the SPI core handed to the driver can be
overrun:
1/2 both SDMA handlers copy the byte count reported by SDMA_SIZE_REG
without checking it against the requested transfer length; a
device reporting more bytes than were programmed makes the
handlers walk past the end of the transfer buffers
2/2 the Marvell b0 transfer path points the SDMA buffers at a
10-byte stack scratch area for transfers without TX data;
transfers longer than that overflow it in both directions and
clock out uninitialized stack bytes to the attached device
The two patches are independent of each other and each carries its own
Fixes: tag, so they can be queued separately.
Tested on x86_64: with both patches applied the driver builds, loads
and unloads cleanly; no xSPI controller is available in this
environment to exercise the slave-DMA paths on hardware. Details are
in the notes of the individual patches.
Signed-off-by: Weibin Liu <liuwb@xiaopeng.com>
---
Weibin Liu (2):
spi: cadence-xspi: reject SDMA transfers larger than the requested
length
spi: cadence-xspi: fix stack buffer overflow in the Marvell b0 path
drivers/spi/spi-cadence-xspi.c | 52 +++++++++++++++++++++++++++-------
1 file changed, 42 insertions(+), 10 deletions(-)
--
2.50.1
next reply other threads:[~2026-09-29 8:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 8:11 Weibin Liu [this message]
2026-09-29 8:11 ` [PATCH 1/2] spi: cadence-xspi: reject SDMA transfers larger than the requested length Weibin Liu
2026-09-29 8:11 ` [PATCH 2/2] spi: cadence-xspi: fix stack buffer overflow in the Marvell b0 path Weibin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260929081146.41041-1-liuwb@xiaopeng.com \
--to=liuwb@xiaopeng.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=pthombar@cadence.com \
--cc=wsadowski@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®