]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
spi: tegra210-quad: Protect curr_xfer in tegra_qspi_combined_seq_xfer
authorBreno Leitao <leitao@debian.org>
Mon, 26 Jan 2026 17:50:29 +0000 (09:50 -0800)
committerMark Brown <broonie@kernel.org>
Fri, 30 Jan 2026 13:53:15 +0000 (13:53 +0000)
commitbf4528ab28e2bf112c3a2cdef44fd13f007781cd
treebf4daa22dcc9fb82e954804451f14efec63d3ae3
parentf5a4d7f5e32ba163cff893493ec1cbb0fd2fb0d5
spi: tegra210-quad: Protect curr_xfer in tegra_qspi_combined_seq_xfer

The curr_xfer field is read by the IRQ handler without holding the lock
to check if a transfer is in progress. When clearing curr_xfer in the
combined sequence transfer loop, protect it with the spinlock to prevent
a race with the interrupt handler.

Protect the curr_xfer clearing at the exit path of
tegra_qspi_combined_seq_xfer() with the spinlock to prevent a race
with the interrupt handler that reads this field.

Without this protection, the IRQ handler could read a partially updated
curr_xfer value, leading to NULL pointer dereference or use-after-free.

Fixes: b4e002d8a7ce ("spi: tegra210-quad: Fix timeout handling")
Signed-off-by: Breno Leitao <leitao@debian.org>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://patch.msgid.link/20260126-tegra_xfer-v2-4-6d2115e4f387@debian.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-tegra210-quad.c