• L
    spi: bcm2835: Fix race on DMA termination · 63f97d30
    Lukas Wunner 提交于
    commit e82b0b3828451c1cd331d9f304c6078fcd43b62e upstream.
    
    If a DMA transfer finishes orderly right when spi_transfer_one_message()
    determines that it has timed out, the callbacks bcm2835_spi_dma_done()
    and bcm2835_spi_handle_err() race to call dmaengine_terminate_all(),
    potentially leading to double termination.
    
    Prevent by atomically changing the dma_pending flag before calling
    dmaengine_terminate_all().
    Signed-off-by: NLukas Wunner <lukas@wunner.de>
    Fixes: 3ecd37ed ("spi: bcm2835: enable dma modes for transfers meeting certain conditions")
    Cc: stable@vger.kernel.org # v4.2+
    Cc: Mathias Duckeck <m.duckeck@kunbus.de>
    Cc: Frank Pavlic <f.pavlic@kunbus.de>
    Cc: Martin Sperl <kernel@martin.sperl.org>
    Cc: Noralf Trønnes <noralf@tronnes.org>
    Signed-off-by: NMark Brown <broonie@kernel.org>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    63f97d30
spi-bcm2835.c 23.0 KB