Skip to content

Commit 6d7723e

Browse files
leitaobroonie
authored andcommitted
spi: tegra210-quad: Protect curr_xfer clearing in tegra_qspi_non_combined_seq_xfer
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]>
1 parent bf4528a commit 6d7723e

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
@@ -1288,6 +1288,7 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
12881288
struct spi_transfer *transfer;
12891289
bool is_first_msg = true;
12901290
int ret = 0, val = 0;
1291+
unsigned long flags;
12911292

12921293
msg->status = 0;
12931294
msg->actual_length = 0;
@@ -1368,7 +1369,9 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi,
13681369
msg->actual_length += xfer->len + dummy_bytes;
13691370

13701371
complete_xfer:
1372+
spin_lock_irqsave(&tqspi->lock, flags);
13711373
tqspi->curr_xfer = NULL;
1374+
spin_unlock_irqrestore(&tqspi->lock, flags);
13721375

13731376
if (ret < 0) {
13741377
tegra_qspi_transfer_end(spi);

0 commit comments

Comments
 (0)