Skip to content

Commit d51554d

Browse files
leitaogregkh
authored andcommitted
spi: tegra210-quad: Protect curr_xfer clearing in tegra_qspi_non_combined_seq_xfer
[ Upstream commit 6d7723e ] Protect the curr_xfer clearing in tegra_qspi_non_combined_seq_xfer() with the spinlock to prevent a race with the interrupt handler that reads this field to check if a transfer is in progress. Fixes: b4e002d ("spi: tegra210-quad: Fix timeout handling") Signed-off-by: Breno Leitao <[email protected]> Tested-by: Jon Hunter <[email protected]> Acked-by: Jon Hunter <[email protected]> Acked-by: Thierry Reding <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3bc293d commit d51554d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/spi/spi-tegra210-quad.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,7 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
12311231
struct spi_transfer *transfer;
12321232
bool is_first_msg = true;
12331233
int ret = 0, val = 0;
1234+
unsigned long flags;
12341235

12351236
msg->status = 0;
12361237
msg->actual_length = 0;
@@ -1304,7 +1305,9 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
13041305
msg->actual_length += xfer->len + dummy_bytes;
13051306

13061307
complete_xfer:
1308+
spin_lock_irqsave(&tqspi->lock, flags);
13071309
tqspi->curr_xfer = NULL;
1310+
spin_unlock_irqrestore(&tqspi->lock, flags);
13081311

13091312
if (ret < 0) {
13101313
tegra_qspi_transfer_end(spi);

0 commit comments

Comments
 (0)