dmaengine: sprd: Fix the possible crash when getting descriptor status
authorBaolin Wang <baolin.wang@linaro.org>
Mon, 6 May 2019 07:28:28 +0000 (15:28 +0800)
committerVinod Koul <vkoul@kernel.org>
Tue, 21 May 2019 13:53:54 +0000 (19:23 +0530)
commit16d0f85e45b99411ac10cb12cdd9279204a72381
tree94947e6ac04bc6fe9b9d3a230cba3f6bcd8d5fe9
parent492252493ea382d12cb61c52295fc2d088bba28f
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>
drivers/dma/sprd-dma.c