summaryrefslogtreecommitdiff
path: root/drivers/dma
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linaro.org>2019-05-06 10:28:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-25 06:34:48 +0300
commitaf410491e083806859c7d43f5d2ddf6eef947942 (patch)
tree70b7034a293bf74ec69f8d0003d7b0391cf45841 /drivers/dma
parent644d39260f9af967f92171088380b906ecd69e28 (diff)
downloadlinux-af410491e083806859c7d43f5d2ddf6eef947942.tar.xz
dmaengine: sprd: Fix the possible crash when getting descriptor status
[ Upstream commit 16d0f85e45b99411ac10cb12cdd9279204a72381 ] 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> Signed-off-by: Sasha Levin <sashal@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);