Commit 36090046 authored by Baolin Wang's avatar Baolin Wang Committed by Greg Kroah-Hartman

dmaengine: sprd: Add validation of current descriptor in irq handler

[ Upstream commit 58152b0e ]

When user terminates one DMA channel to free all its descriptors, but
at the same time one transaction interrupt was triggered possibly, now
we should not handle this interrupt by validating if the 'schan->cur_desc'
was set as NULL to avoid crashing the kernel.
Signed-off-by: default avatarBaolin Wang <baolin.wang@linaro.org>
Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent af410491
...@@ -552,12 +552,17 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) ...@@ -552,12 +552,17 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id)
schan = &sdev->channels[i]; schan = &sdev->channels[i];
spin_lock(&schan->vc.lock); spin_lock(&schan->vc.lock);
sdesc = schan->cur_desc;
if (!sdesc) {
spin_unlock(&schan->vc.lock);
return IRQ_HANDLED;
}
int_type = sprd_dma_get_int_type(schan); int_type = sprd_dma_get_int_type(schan);
req_type = sprd_dma_get_req_type(schan); req_type = sprd_dma_get_req_type(schan);
sprd_dma_clear_int(schan); sprd_dma_clear_int(schan);
sdesc = schan->cur_desc;
/* cyclic mode schedule callback */ /* cyclic mode schedule callback */
cyclic = schan->linklist.phy_addr ? true : false; cyclic = schan->linklist.phy_addr ? true : false;
if (cyclic == true) { if (cyclic == true) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment