projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5b215c2
)
dmaengine: imx-sdma: fix cyclic buffer race condition
author
Tomasz Moń
<tomasz.mon@camlingroup.com>
Mon, 17 Jan 2022 09:19:55 +0000
(10:19 +0100)
committer
Vinod Koul
<vkoul@kernel.org>
Tue, 15 Feb 2022 05:41:06 +0000
(11:11 +0530)
Assign buffer ownership to SDMA after invoking descriptor callback to
make sure that SDMA does not write to the buffer before it is read by
the CPU.
Signed-off-by: Tomasz Moń <tomasz.mon@camlingroup.com>
Link:
https://lore.kernel.org/r/20220117091955.1038937-2-tomasz.mon@camlingroup.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/imx-sdma.c
patch
|
blob
|
history
diff --git
a/drivers/dma/imx-sdma.c
b/drivers/dma/imx-sdma.c
index 330ff41cd6143da8cbf952225ec0e92b6f015309..8cc5103193c3cac0c476e306807a2f2dd533c30a 100644
(file)
--- a/
drivers/dma/imx-sdma.c
+++ b/
drivers/dma/imx-sdma.c
@@
-847,7
+847,6
@@
static void sdma_update_channel_loop(struct sdma_channel *sdmac)
*/
desc->chn_real_count = bd->mode.count;
- bd->mode.status |= BD_DONE;
bd->mode.count = desc->period_len;
desc->buf_ptail = desc->buf_tail;
desc->buf_tail = (desc->buf_tail + 1) % desc->num_bd;
@@
-862,6
+861,9
@@
static void sdma_update_channel_loop(struct sdma_channel *sdmac)
dmaengine_desc_get_callback_invoke(&desc->vd.tx, NULL);
spin_lock(&sdmac->vc.lock);
+ /* Assign buffer ownership to SDMA */
+ bd->mode.status |= BD_DONE;
+
if (error)
sdmac->status = old_status;
}