summaryrefslogtreecommitdiffstats
path: root/scripts/package/debian/rules
diff options
context:
space:
mode:
authorChristian Lugnberg <christian.lugnberg@soundtrack.io>2026-08-17 15:51:22 +0200
committerVinod Koul <vkoul@kernel.org>2026-09-10 17:57:46 +0530
commitc90b6973daa37f4c283342dff881ae001dea4fe6 (patch)
tree475589693e18a38d667d1d321613c2953518cbf0 /scripts/package/debian/rules
parentcee9c863ee68cb27d66745eb03f60e357f4f8ad2 (diff)
downloadlinux-stable-c90b6973daa37f4c283342dff881ae001dea4fe6.tar.gz
linux-stable-c90b6973daa37f4c283342dff881ae001dea4fe6.zip
dmaengine: sun6i: fix non-atomic read of DMA position registers
sun6i_get_chan_size() reads DMA_CHAN_LLI_ADDR and DMA_CHAN_CUR_CNT in two separate readl() calls with no synchronisation between them: pos = readl(pchan->base + DMA_CHAN_LLI_ADDR); bytes = readl(pchan->base + DMA_CHAN_CUR_CNT); DMA_CHAN_LLI_ADDR holds the physical address of the *next* descriptor the engine will load once the current one completes. DMA_CHAN_CUR_CNT holds the remaining byte count for the *current* descriptor. If the DMA engine advances to the next LLI entry between the two reads, pos becomes stale: it still points to what was the next descriptor at the time of the first read, but that descriptor is now the current one and CUR_CNT reflects its initial (full) byte count. The subsequent virtual-chain walk starts one entry too early and accumulates an extra full period's worth of bytes into the residue estimate. Fix this by re-reading DMA_CHAN_LLI_ADDR after DMA_CHAN_CUR_CNT and retrying if the value changed. This double-read pattern guarantees that both registers were sampled during the same descriptor interval. The cost is at most one extra readl() pair per call in the racy case, which occurs only at descriptor boundaries (~every 2 ms) and is negligible. Fixes: a90e173f3faf ("dmaengine: sun6i: Add cyclic capability") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Christian Lugnberg <christian.lugnberg@soundtrack.io> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20260817135723.12807-2-christian.lugnberg@soundtrack.io Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'scripts/package/debian/rules')
0 files changed, 0 insertions, 0 deletions