From: Mark Brown Date: Wed, 10 Jul 2013 14:05:40 +0000 (+0100) Subject: spi: More sanity checks for transfers X-Git-Tag: v3.12-rc1~192^2~10^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24a0013a04e81e95198daab98edf4df02e191568;p=profile%2Fivi%2Fkernel-x86-ivi.git spi: More sanity checks for transfers Check that transfers are non-empty and that there is a completion for them. Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index a52f166..c289916 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1351,6 +1351,11 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message) struct spi_master *master = spi->master; struct spi_transfer *xfer; + if (list_empty(&message->transfers)) + return -EINVAL; + if (!message->complete) + return -EINVAL; + /* Half-duplex links include original MicroWire, and ones with * only one data pin like SPI_3WIRE (switches direction) or where * either MOSI or MISO is missing. They can also be caused by