From: Nicolas Ferre Date: Wed, 12 Jan 2011 14:39:10 +0000 (+0100) Subject: dmaengine: at_hdmac: fix race while monitoring channel status X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dda36f9821321edf65d69da5c0807df7e73d26fc;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git dmaengine: at_hdmac: fix race while monitoring channel status We were reading channel status then taking a lock. This lead to a race because this lock may delay us and then make this channel not idle anymore. Signed-off-by: Nicolas Ferre Signed-off-by: Dan Williams --- diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 3938db210834..40f2bf4ae474 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -853,11 +853,11 @@ static void atc_issue_pending(struct dma_chan *chan) dev_vdbg(chan2dev(chan), "issue_pending\n"); + spin_lock_bh(&atchan->lock); if (!atc_chan_is_enabled(atchan)) { - spin_lock_bh(&atchan->lock); atc_advance_work(atchan); - spin_unlock_bh(&atchan->lock); } + spin_unlock_bh(&atchan->lock); } /**