All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Guanglei Zhu <zhugl3@xiaopeng.com>
Cc: stable@vger.kernel.org, liuwb@xiaopeng.com,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 5.10.y] spi: amd: fix len==0 underflow and FIFO overflow
Date: Thu, 26 Nov 2026 15:31:00 +0100	[thread overview]
Message-ID: <2026112642-password-shrouded-e676@gregkh> (raw)
In-Reply-To: <20261109030624.419576-1-zhugl3@xiaopeng.com>

On Mon, Nov 09, 2026 at 11:06:24AM +0800, Guanglei Zhu wrote:
> From: Weibin Liu <liuwb@xiaopeng.com>
> 
> [ Upstream commit e2f4edfc061e493fddde16c4bbe1c4f230f41e4a ]
> 
> amd_spi_fifo_xfer() unconditionally decrements xfer->len when a tx_buf
> is present. The SPI core does not reject zero-length transfers, so a
> transfer submitted through the SPI_IOC_MESSAGE ioctl with len == 0 and
> a tx_buf makes the u32 len wrap to 0xFFFFFFFF, and the following
> per-byte loop writes far past the FIFO window.
> 
> The driver also never checks the transfer length against
> AMD_SPI_FIFO_SIZE. The core splits each transfer down to the
> controller's max transfer size but does not bound the total message
> length, so a long transfer overflows the FIFO with out-of-bounds MMIO
> writes (tx) and reads (rx).
> 
> Skip zero-length transfers and reject any transfer that would run past
> the end of the FIFO window.
> 
> Fixes: bbb336f39efc ("spi: spi-amd: Add AMD SPI controller driver support")
> Cc: stable@vger.kernel.org # 5.8+
> Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com>
> Signed-off-by: Weibin Liu <liuwb@xiaopeng.com>
> Link: https://patch.msgid.link/20261014-spi-amd-fifo-fix-v1-1-9fec9ab753e8@xiaopeng.com
> Signed-off-by: Mark Brown <broonie@kernel.org>
> [ Adapted for 5.10.y: this tree has no per-message FIFO position tracking, so the check is a per-transfer bound against AMD_SPI_FIFO_SIZE, matching the per-byte loop offsets here. ]
> Signed-off-by: Guanglei Zhu <zhugl3@xiaopeng.com>
> Signed-off-by: Weibin Liu <liuwb@xiaopeng.com>
> ---
>  drivers/spi/spi-amd.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

No, dropping this, you forgot the fixup patch for this one, this
introduces a bug :(


      reply	other threads:[~2026-11-26 14:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 11:24 FAILED: patch "[PATCH] spi: amd: fix len==0 underflow and FIFO overflow" failed to apply to 5.10-stable tree Sasha Levin
2026-11-09  3:06 ` [PATCH 5.10.y] spi: amd: fix len==0 underflow and FIFO overflow Guanglei Zhu
2026-11-26 14:31   ` Greg KH [this message]

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=2026112642-password-shrouded-e676@gregkh \
    --to=greg@kroah.com \
    --cc=broonie@kernel.org \
    --cc=liuwb@xiaopeng.com \
    --cc=stable@vger.kernel.org \
    --cc=zhugl3@xiaopeng.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.