Patch "spi: Skip zero-length transfers in spi_transfer_one_message()" has been added to the 5.11-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: Skip zero-length transfers in spi_transfer_one_message()

to the 5.11-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-skip-zero-length-transfers-in-spi_transfer_one_m.patch
and it can be found in the queue-5.11 subdirectory.

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



commit 09a79c83558ecbbc524439d70de3d7fe668f17b2
Author: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
Date:   Thu Feb 11 19:08:20 2021 +0100

    spi: Skip zero-length transfers in spi_transfer_one_message()
    
    [ Upstream commit b306320322c9cfaa465bc2c7367acf6072b1ac0e ]
    
    With the introduction of 26751de25d25 ("spi: bcm2835: Micro-optimise
    FIFO loops") it has become apparent that some users might initiate
    zero-length SPI transfers. A fact the micro-optimization omitted, and
    which turned out to cause crashes[1].
    
    Instead of changing the micro-optimization itself, use a bigger hammer
    and skip zero-length transfers altogether for drivers using the default
    transfer_one_message() implementation.
    
    Reported-by: Phil Elwell <phil@xxxxxxxxxxxxxxx>
    Fixes: 26751de25d25 ("spi: bcm2835: Micro-optimise FIFO loops")
    Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
    
    [1] https://github.com/raspberrypi/linux/issues/4100
    Link: https://lore.kernel.org/r/20210211180820.25757-1-nsaenzjulienne@xxxxxxx
    
    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 720ab34784c1d..ccca3a7409fac 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1267,7 +1267,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr,
 			ptp_read_system_prets(xfer->ptp_sts);
 		}
 
-		if (xfer->tx_buf || xfer->rx_buf) {
+		if ((xfer->tx_buf || xfer->rx_buf) && xfer->len) {
 			reinit_completion(&ctlr->xfer_completion);
 
 fallback_pio:



[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