[PATCH v2 0/2] dmaengine: bcm2835-dma: Fix OF DMA controller lifetime
From: Tomasz Unger
Date: Thu Nov 19 2026 - 15:38:34 EST
Patch 1 is the minimal fix from v1: free the OF DMA controller in
remove and on the probe error path. It is unchanged and meant for
stable.
Patch 2 converts the driver to devres as suggested by Frank Li in the
v1 review. The OF controller is now registered last, after the DMA
device, and freed first, which also closes the window in probe where
a channel could be requested from a device that was not registered
yet. It uses devm_of_dma_controller_register(), so it is not meant
for stable.
Verified on a Raspberry Pi 4 Model B: unbinding vc4 and the DMA
controller and binding vc4 again oopses without the series. With
patch 1 alone and with the whole series, binding vc4 is deferred while
the controller is unbound, and HDMI audio gets its DMA channels back
once it is bound again. The remove path and a forced probe failure
were also run under KASAN in QEMU raspi4b, again with patch 1 alone
and with the whole series: slab-use-after-free in find_candidate()
without the series, no report with it.
Signed-off-by: Tomasz Unger <tomasz.unger@xxxxxxxx>
---
Changes in v2:
- Add patch 2: devres conversion (Frank Li)
- Patch 1 unchanged
- Link to v1: https://patch.msgid.link/20261115-bcm2835-dma-of-dma-free-v1-1-d539234bfec5@xxxxxxxx
---
Tomasz Unger (2):
dmaengine: bcm2835-dma: Add missing of_dma_controller_free()
dmaengine: bcm2835-dma: Convert to managed resources
drivers/dma/bcm2835-dma.c | 53 ++++++++++++++++++++++++-----------------------
1 file changed, 27 insertions(+), 26 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261115-bcm2835-dma-of-dma-free-ef85776c0914
Best regards,
--
Tomasz Unger <tomasz.unger@xxxxxxxx>