summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2019-05-06 10:28:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-25 06:34:48 +0300
commit36090046e762aa70c118b501bdf2b3aa79c112d5 (patch)
tree8a2e5f41efa5652c2e49e7a8bfe6616a43bf6f5a /drivers/dma
parentaf410491e083806859c7d43f5d2ddf6eef947942 (diff)
downloadlinux-36090046e762aa70c118b501bdf2b3aa79c112d5.tar.xz
dmaengine: sprd: Add validation of current descriptor in irq handler
[ Upstream commit 58152b0e573e5581c4b9ef7cf06d2e9fafae27d4 ] 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: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sprd-dma.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index e29342ab85f6..431e289d59a5 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -552,12 +552,17 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id)
schan = &sdev->channels[i];
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);
req_type = sprd_dma_get_req_type(schan);
sprd_dma_clear_int(schan);
- sdesc = schan->cur_desc;
-
/* cyclic mode schedule callback */
cyclic = schan->linklist.phy_addr ? true : false;
if (cyclic == true) {