All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Mark Brown <broonie@kernel.org>,
	Anton Vorontsov <avorontsov@ru.mvista.com>,
	Giulio Benetti <giulio.benetti@benettiengineering.com>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 01/10] spi: fsl-cpm: Map the zero page's address, not its struct page
Date: Thu, 19 Nov 2026 09:17:13 +0000	[thread overview]
Message-ID: <20261119091810.3440619-2-lee@kernel.org> (raw)
In-Reply-To: <20261119091810.3440619-1-lee@kernel.org>

fsl_spi_cpm_init() maps a dummy TX buffer which is used for transfers
that have no tx_buf.  Since the conversion from empty_zero_page to
ZERO_PAGE(0), the struct page pointer returned by ZERO_PAGE() has been
handed directly to dma_map_single(), which expects a kernel virtual
address.

As a result the mapping covers a PAGE_SIZE window of the memory map
rather than a page of zeroes, and that struct page metadata is then
clocked out onto the SPI bus for every RX-only transfer.

Pass page_address(ZERO_PAGE(0)) instead, so that the zero page itself is
mapped.

Fixes: 3be6acda8241 ("spi: fsl-cpm: substitute empty_zero_page with helper ZERO_PAGE(0)")
Closes: https://sashiko.dev/#/bug/linux-8dbfe527-3ba3-488a-a6fb-d4ee650b8ca7
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/spi/spi-fsl-cpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 23ad1249f121..ccdd62f3c74b 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -350,7 +350,8 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
 		goto err_bds;
 	}
 
-	mspi->dma_dummy_tx = dma_map_single(dev, ZERO_PAGE(0), PAGE_SIZE,
+	mspi->dma_dummy_tx = dma_map_single(dev, page_address(ZERO_PAGE(0)),
+					    PAGE_SIZE,
 					    DMA_TO_DEVICE);
 	if (dma_mapping_error(dev, mspi->dma_dummy_tx)) {
 		dev_err(dev, "unable to map dummy tx buffer\n");
-- 
2.56.1.708.g77570a6a1d-goog


  reply	other threads:[~2026-11-19  9:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  9:17 [PATCH 00/10] spi: Fix data corruption, uninitialised data leaks and bounds checks Lee Jones
2026-11-19  9:17 ` Lee Jones [this message]
2026-11-19  9:17 ` [PATCH 02/10] spi: bcm2835: Store native chip-select GPIO descriptor per device Lee Jones
2026-11-19  9:17 ` [PATCH 03/10] spi: ch341: Limit transfers to the hardware packet size Lee Jones
2026-11-19  9:17 ` [PATCH 04/10] spi: sprd-adi: Do not copy uninitialised data to rx_buf on read failure Lee Jones
2026-11-19  9:17 ` [PATCH 05/10] spi: topcliff-pch: Advance tx_buf between DMA chunks Lee Jones
2026-11-19  9:17 ` [PATCH 06/10] spi: cadence-quadspi: Bound chip select against f_pdata array size Lee Jones
2026-11-19 10:15   ` Théo Lebrun
2026-11-19 14:33     ` Lee Jones
2026-11-19 14:55       ` Théo Lebrun
2026-11-19 15:32         ` Lee Jones
2026-11-19  9:17 ` [PATCH 07/10] spi: cadence-xspi: Zero the tail word in m_iowriteq() Lee Jones
2026-11-19  9:17 ` [PATCH 08/10] spi: fsl-qspi: Propagate clock errors from fsl_qspi_select_mem() Lee Jones
2026-11-19  9:17 ` [PATCH 09/10] spi: cadence-xspi: Advance tx pointer between Marvell b0 chunks Lee Jones
2026-11-19  9:17 ` [PATCH 10/10] spi: cadence-xspi: Skip tail read for qword-aligned Marvell b0 receives Lee Jones

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=20261119091810.3440619-2-lee@kernel.org \
    --to=lee@kernel.org \
    --cc=avorontsov@ru.mvista.com \
    --cc=broonie@kernel.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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.