lkml.org 
[lkml]   [2019]   [Sep]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.4 19/23] spi: bcm2835aux: remove dangerous uncontrolled read of fifo
    Date
    [ Upstream commit c7de8500fd8ecbb544846dd5f11dca578c3777e1 ]

    This read of the fifo is a potential candidate for a race condition
    as the spi transfer is not necessarily finished and so can lead to
    an early read of the fifo that still misses data.

    So it has been removed.

    Fixes: 1ea29b39f4c812ec ("spi: bcm2835aux: add bcm2835 auxiliary spi device...")
    Suggested-by: Hubert Denkmair <h.denkmair@intence.de>
    Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
    Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/spi/spi-bcm2835aux.c | 7 -------
    1 file changed, 7 deletions(-)

    diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
    index 5b2c2b2e13396..4d233356772aa 100644
    --- a/drivers/spi/spi-bcm2835aux.c
    +++ b/drivers/spi/spi-bcm2835aux.c
    @@ -197,13 +197,6 @@ static void bcm2835aux_spi_transfer_helper(struct bcm2835aux_spi *bs)
    BCM2835_AUX_SPI_STAT_TX_FULL))) {
    bcm2835aux_wr_fifo(bs);
    }
    -
    - /* and check if we have reached "done" */
    - while (bs->rx_len &&
    - (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
    - BCM2835_AUX_SPI_STAT_BUSY))) {
    - bcm2835aux_rd_fifo(bs);
    - }
    }

    static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
    --
    2.20.1


    \
     
     \ /
      Last update: 2019-09-08 15:01    [W:2.142 / U:0.388 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site