Skip to content

Commit 49d0b52

Browse files
committed
spi: check ctrl->cur_msg validity before dereferencing
In case an SPI transfer fails the mesg has been identified on SAMA5D2 ICP as being NULL. Thus check its validity to avoid a crash. Fixes: 8caab75 ("spi: Generalize SPI "master" to "controller"") Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
1 parent b571c85 commit 49d0b52

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/spi/spi.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,8 @@ void spi_finalize_current_message(struct spi_controller *ctlr)
20012001
int ret;
20022002

20032003
mesg = ctlr->cur_msg;
2004+
if (!mesg)
2005+
return;
20042006

20052007
if (!ctlr->ptp_sts_supported && !ctlr->transfer_one) {
20062008
list_for_each_entry(xfer, &mesg->transfers, transfer_list) {

0 commit comments

Comments
 (0)