]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: dmatest: move callback wait queue to thread context
authorAdam Wallis <awallis@codeaurora.org>
Mon, 27 Nov 2017 15:45:01 +0000 (10:45 -0500)
committerVinod Koul <vinod.koul@intel.com>
Mon, 11 Dec 2017 03:16:24 +0000 (08:46 +0530)
commitf886b80047f321e9878166b0310bb002aeb8feb7
treedf3f91fcb031b8130031881c05d1307c4ac90ab8
parente40332889e4203a33ff2946d04ecabc03a377a52
dmaengine: dmatest: move callback wait queue to thread context

Commit ea99d7979275 ("dmatest: don't use set_freezable_with_signal()")
introduced a bug (that is in fact documented by the patch commit text)
that leaves behind a dangling pointer. Since the done_wait structure is
allocated on the stack, future invocations to the DMATEST can produce
undesirable results (e.g., corrupted spinlocks).

Commit 7e4b7db9d1c3 ("dmaengine: dmatest: warn user when dma test times
out") attempted to WARN the user that the stack was likely corrupted but
did not fix the actual issue.

This patch fixes the issue by pushing the wait queue and callback
structs into the the thread structure. If a failure occurs due to time,
dmaengine_terminate_all will force the callback to safely call
wake_up_all() without possibility of using a freed pointer.

Cc: stable@vger.kernel.org
Bug: https://bugzilla.kernel.org/show_bug.cgi?id=197605
Fixes: ea99d7979275 ("dmatest: don't use set_freezable_with_signal()")
Reviewed-by: Sinan Kaya <okaya@codeaurora.org>
Suggested-by: Shunyong Yang <shunyong.yang@hxt-semitech.com>
Signed-off-by: Adam Wallis <awallis@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/dmatest.c