summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2019-05-06 10:28:28 +0300
committerVinod Koul <vkoul@kernel.org>2019-05-21 16:53:54 +0300
commit16d0f85e45b99411ac10cb12cdd9279204a72381 (patch)
tree94947e6ac04bc6fe9b9d3a230cba3f6bcd8d5fe9 /drivers/dma
parent492252493ea382d12cb61c52295fc2d088bba28f (diff)
downloadlinux-16d0f85e45b99411ac10cb12cdd9279204a72381.tar.xz
dmaengine: sprd: Fix the possible crash when getting descriptor status
We will get a NULL virtual descriptor by vchan_find_desc() when the descriptor has been submitted, that will crash the kernel when getting the descriptor status. In this case, since the descriptor has been submitted to process, but it is not completed now, which means the descriptor is listed into the 'vc->desc_submitted' list now. So we can not get current processing descriptor by vchan_find_desc(), but the pointer 'schan->cur_desc' will point to the current processing descriptor, then we can use 'schan->cur_desc' to get current processing descriptor's status to avoid this issue. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sprd-dma.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 48431e2da987..e29342ab85f6 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -625,7 +625,7 @@ static enum dma_status sprd_dma_tx_status(struct dma_chan *chan,
else
pos = 0;
} else if (schan->cur_desc && schan->cur_desc->vd.tx.cookie == cookie) {
- struct sprd_dma_desc *sdesc = to_sprd_dma_desc(vd);
+ struct sprd_dma_desc *sdesc = schan->cur_desc;
if (sdesc->dir == DMA_DEV_TO_MEM)
pos = sprd_dma_get_dst_addr(schan);