spi: tegra210-quad: Move curr_xfer read inside spinlock

Move the assignment of the transfer pointer from curr_xfer inside the
spinlock critical section in both handle_cpu_based_xfer() and
handle_dma_based_xfer().

Previously, curr_xfer was read before acquiring the lock, creating a
window where the timeout path could clear curr_xfer between reading it
and using it. By moving the read inside the lock, the handlers are
guaranteed to see a consistent value that cannot be modified by the
timeout path.

Fixes: 921fc1838fb0 ("spi: tegra210-quad: Add support for Tegra210 QSPI controller")
Signed-off-by: Breno Leitao <leitao@debian.org>
Acked-by: Thierry Reding <treding@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://patch.msgid.link/20260126-tegra_xfer-v2-2-6d2115e4f387@debian.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by Breno Leitao and committed by Mark Brown ef13ba35 aabd8ea0

+4 -2
+4 -2
drivers/spi/spi-tegra210-quad.c
··· 1440 1440 1441 1441 static irqreturn_t handle_cpu_based_xfer(struct tegra_qspi *tqspi) 1442 1442 { 1443 - struct spi_transfer *t = tqspi->curr_xfer; 1443 + struct spi_transfer *t; 1444 1444 unsigned long flags; 1445 1445 1446 1446 spin_lock_irqsave(&tqspi->lock, flags); 1447 + t = tqspi->curr_xfer; 1447 1448 1448 1449 if (tqspi->tx_status || tqspi->rx_status) { 1449 1450 tegra_qspi_handle_error(tqspi); ··· 1475 1474 1476 1475 static irqreturn_t handle_dma_based_xfer(struct tegra_qspi *tqspi) 1477 1476 { 1478 - struct spi_transfer *t = tqspi->curr_xfer; 1477 + struct spi_transfer *t; 1479 1478 unsigned int total_fifo_words; 1480 1479 unsigned long flags; 1481 1480 long wait_status; ··· 1514 1513 } 1515 1514 1516 1515 spin_lock_irqsave(&tqspi->lock, flags); 1516 + t = tqspi->curr_xfer; 1517 1517 1518 1518 if (num_errors) { 1519 1519 tegra_qspi_dma_unmap_xfer(tqspi, t);