Skip to content

Commit 43e41b0

Browse files
claudiubezneaduraikvddp
authored andcommitted
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 5ff0e74 commit 43e41b0

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
@@ -2000,6 +2000,8 @@ void spi_finalize_current_message(struct spi_controller *ctlr)
20002000
int ret;
20012001

20022002
mesg = ctlr->cur_msg;
2003+
if (!mesg)
2004+
return;
20032005

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

0 commit comments

Comments
 (0)