]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: dw: dmamux: fix OF node leak on route allocation failure
authorJohan Hovold <johan@kernel.org>
Mon, 17 Nov 2025 16:12:47 +0000 (17:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:44:01 +0000 (16:44 +0100)
commit ec25e60f9f95464aa11411db31d0906b3fb7b9f2 upstream.

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

Fixes: 134d9c52fca2 ("dmaengine: dw: dmamux: Introduce RZN1 DMA router support")
Cc: stable@vger.kernel.org # 5.19
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20251117161258.10679-6-johan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/dma/dw/rzn1-dmamux.c

index e7d87d952648bd6ac843eb6a6b4f634063beaa1a..e548446e7e258ab0d02bb48eeee7e21c8060f797 100644 (file)
@@ -88,7 +88,7 @@ static void *rzn1_dmamux_route_allocate(struct of_phandle_args *dma_spec,
 
        if (test_and_set_bit(map->req_idx, dmamux->used_chans)) {
                ret = -EBUSY;
-               goto free_map;
+               goto put_dma_spec_np;
        }
 
        mask = BIT(map->req_idx);
@@ -101,6 +101,8 @@ static void *rzn1_dmamux_route_allocate(struct of_phandle_args *dma_spec,
 
 clear_bitmap:
        clear_bit(map->req_idx, dmamux->used_chans);
+put_dma_spec_np:
+       of_node_put(dma_spec->np);
 free_map:
        kfree(map);
 put_device: