diff options
| author | Logan Gunthorpe <logang@deltatee.com> | 2026-09-02 00:21:44 -0600 |
|---|---|---|
| committer | Vinod Koul <vkoul@kernel.org> | 2026-10-05 15:44:11 +0200 |
| commit | 1188942d6160b9f799af297bdb5d7812cd7fde6d (patch) | |
| tree | 1b767de12b6b79d7035d52f015f8a1c85cc08f86 /tools/lib/python/kdoc/python_version.py | |
| parent | bdfd76514bd11301f4e67d150485ab696c26d83d (diff) | |
dmaengine: switchtec-dma: fix resource leak in alloc_chan_resources
switchtec_dma_alloc_chan_resources() returns directly on any later
failure, without ever freeing the descriptor rings and coherent DMA
memory it just allocated. The dmaengine core does not call
device_free_chan_resources() when device_alloc_chan_resources() fails,
so the driver has to unwind its own partial state.
The device-removed check also runs after ring_active and
comp_ring_active have already been set true, so a failure there left
the channel marked active despite alloc_chan_resources() reporting
failure.
Add an error-unwind path that disables the channel and frees the
descriptor rings on every failure after allocation. ring_active and
comp_ring_active are cleared under the same locks
switchtec_dma_free_chan_resources() already uses, since the completion
tasklet checks comp_ring_active under complete_lock before touching
the completion ring, and a stale IRQ can still be in flight when this
unwind path runs.
Reported-by: Sashiko <sashiko-bot@kernel.org>
Link: https://lore.kernel.org/dmaengine/20260707165555.350951F000E9@smtp.kernel.org
Fixes: 30eba9df76ad ("dmaengine: switchtec-dma: Implement hardware initialization and cleanup")
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Link: https://lore.kernel.org/dmaengine/20260707165555.350951F000E9@smtp.kernel.org/T/#u
Link: https://patch.msgid.link/20260902062153.31048-3-logang@deltatee.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
