]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: pl330: fix irq race with terminate_all
authorJohn Keeping <john@metanate.com>
Tue, 17 Jul 2018 10:48:16 +0000 (11:48 +0100)
committerVinod Koul <vkoul@kernel.org>
Wed, 25 Jul 2018 12:29:57 +0000 (17:59 +0530)
commitbb6cc8b982d1793883a3576b735b46d816cbd26d
treeee855be5edc379bd8b8e13db4104b7746434c660
parentb793945c5a1163ab42736fe9f93bdc71994ecb6c
dmaengine: pl330: fix irq race with terminate_all

In pl330_update() when checking if a channel has been aborted, the
channel's lock is not taken, only the overall pl330_dmac lock.  But in
pl330_terminate_all() the aborted flag (req_running==-1) is set under
the channel lock and not the pl330_dmac lock.

With threaded interrupts, this leads to a potential race:

    pl330_terminate_all         pl330_update
    -------------------         ------------
    lock channel
                                entry
    lock pl330
    _stop channel
    unlock pl330
                                lock pl330
                                check req_running != -1
    req_running = -1
                                _start channel

Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/pl330.c