]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jun 2019 03:34:48 +0000 (11:34 +0800)
commitaf410491e083806859c7d43f5d2ddf6eef947942
tree70b7034a293bf74ec69f8d0003d7b0391cf45841
parent644d39260f9af967f92171088380b906ecd69e28
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>
drivers/dma/sprd-dma.c