diff mbox series

spi: Fix Raspberry Pi breakage

Message ID 20190509023005.19290-1-broonie@kernel.org
State Accepted
Commit 0ed56252c9567351344cb7b5cff6140e1bcec943
Headers show
Series spi: Fix Raspberry Pi breakage | expand

Commit Message

Mark Brown May 9, 2019, 2:30 a.m. UTC
This reverts commit c9ba7a16d0f1 (Release spi_res after finalizing
message) which causes races during cleanup.

Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>

---
 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.20.1

Comments

Martin Sperl May 9, 2019, 10:56 a.m. UTC | #1
> On 09.05.2019, at 04:30, Mark Brown <broonie@kernel.org> wrote:

> 

> This reverts commit c9ba7a16d0f1 (Release spi_res after finalizing

> message) which causes races during cleanup.

> 

> Reported-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

> Signed-off-by: Mark Brown <broonie@kernel.org>


I have just posted a possible mitigation patch.

@Nicolas + Noralf: please see if this solves both of your issues.

Note that the first one is the most essential.

Thanks,
	Martin
diff mbox series

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 5e75944ad5d1..8eb7460dd744 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1181,10 +1181,10 @@  static int spi_transfer_one_message(struct spi_controller *ctlr,
 	if (msg->status && ctlr->handle_err)
 		ctlr->handle_err(ctlr, msg);
 
-	spi_finalize_current_message(ctlr);
-
 	spi_res_release(ctlr, msg);
 
+	spi_finalize_current_message(ctlr);
+
 	return ret;
 }