mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-11 21:14:07 +08:00
spi: Skip zero-length transfers in spi_transfer_one_message()
With the introduction of26751de25d
("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@raspberrypi.com> Fixes:26751de25d
("spi: bcm2835: Micro-optimise FIFO loops") Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> [1] https://github.com/raspberrypi/linux/issues/4100 Link: https://lore.kernel.org/r/20210211180820.25757-1-nsaenzjulienne@suse.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
386f771aad
commit
b306320322
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user