Patch "spi: Don't mark message DMA mapped when no transfer in it is" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    spi: Don't mark message DMA mapped when no transfer in it is

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-don-t-mark-message-dma-mapped-when-no-transfer-i.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d88499bc76cd8e7cf8809b55860473f672c3e483
Author: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Date:   Wed May 22 20:09:49 2024 +0300

    spi: Don't mark message DMA mapped when no transfer in it is
    
    [ Upstream commit 9f788ba457b45b0ce422943fcec9fa35c4587764 ]
    
    There is no need to set the DMA mapped flag of the message if it has
    no mapped transfers. Moreover, it may give the code a chance to take
    the wrong paths, i.e. to exercise DMA related APIs on unmapped data.
    Make __spi_map_msg() to bail earlier on the above mentioned cases.
    
    Fixes: 99adef310f68 ("spi: Provide core support for DMA mapping transfers")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
    Link: https://msgid.link/r/20240522171018.3362521-2-andriy.shevchenko@xxxxxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b18ae50db1f52..0f9410ed48290 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -931,6 +931,7 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
 	else
 		rx_dev = ctlr->dev.parent;
 
+	ret = -ENOMSG;
 	list_for_each_entry(xfer, &msg->transfers, transfer_list) {
 		if (!ctlr->can_dma(ctlr, msg->spi, xfer))
 			continue;
@@ -954,6 +955,9 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
 			}
 		}
 	}
+	/* No transfer has been mapped, bail out with success */
+	if (ret)
+		return 0;
 
 	ctlr->cur_msg_mapped = true;
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux