]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: stm32: dmamux: fix OF node leak on route allocation failure
authorJohan Hovold <johan@kernel.org>
Wed, 21 Jan 2026 12:24:45 +0000 (07:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:44:19 +0000 (16:44 +0100)
[ Upstream commit b1b590a590af13ded598e70f0b72bc1e515787a1 ]

Make sure to drop the reference taken to the DMA master OF node also on
late route allocation failures.

Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
Cc: stable@vger.kernel.org # 4.15
Cc: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/20251117161258.10679-12-johan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma/stm32-dmamux.c

index ee3cbbf510065acc5d5dbd58d3d7acdb4c5eae3d..d6163c5ab206bc08f64dfb99926c164866b1e88e 100644 (file)
@@ -140,7 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec,
        ret = pm_runtime_resume_and_get(&pdev->dev);
        if (ret < 0) {
                spin_unlock_irqrestore(&dmamux->lock, flags);
-               goto error;
+               goto err_put_dma_spec_np;
        }
        spin_unlock_irqrestore(&dmamux->lock, flags);
 
@@ -160,6 +160,8 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec,
 
        return mux;
 
+err_put_dma_spec_np:
+       of_node_put(dma_spec->np);
 error:
        clear_bit(mux->chan_id, dmamux->dma_inuse);