]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dmaengine: ti: edma: fix OF node reference leaks in edma_driver
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Thu, 19 Dec 2024 02:05:07 +0000 (11:05 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:46:56 +0000 (12:46 +0100)
[ Upstream commit e883c64778e5a9905fce955681f8ee38c7197e0f ]

The .probe() of edma_driver calls of_parse_phandle_with_fixed_args() but
does not release the obtained OF nodes. Thus add a of_node_put() call.

This bug was found by an experimental verification tool that I am
developing.

Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/20241219020507.1983124-3-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/ti/edma.c

index 69292d4a0c44194c8a0f0de985154ff89ba2722b..560fe658b8942eb7d46c0e7e2ca93a918d4a1439 100644 (file)
@@ -217,7 +217,6 @@ struct edma_desc {
 struct edma_cc;
 
 struct edma_tc {
-       struct device_node              *node;
        u16                             id;
 };
 
@@ -2524,13 +2523,13 @@ static int edma_probe(struct platform_device *pdev)
                        if (ret || i == ecc->num_tc)
                                break;
 
-                       ecc->tc_list[i].node = tc_args.np;
                        ecc->tc_list[i].id = i;
                        queue_priority_mapping[i][1] = tc_args.args[0];
                        if (queue_priority_mapping[i][1] > lowest_priority) {
                                lowest_priority = queue_priority_mapping[i][1];
                                info->default_queue = i;
                        }
+                       of_node_put(tc_args.np);
                }
 
                /* See if we have optional dma-channel-mask array */