* [PATCH] of: unittest: Fix np reference leak in of_unittest_pci_empty_dma_ranges()
@ 2026-09-17 13:03 Wentao Liang
2026-09-17 14:33 ` Andrea della Porta
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-17 13:03 UTC (permalink / raw)
To: andrea.porta
Cc: devicetree, linux-kernel, robh, saravanak, Wentao Liang, stable
of_pci_dma_range_parser_init() can fail when the node lacks a dma-ranges
property. That error path returns without dropping the reference taken
by of_find_node_by_path(). Add the missing of_node_put().
Fixes: 1a75e81baf4f ("of/unittest: Add empty dma-ranges address translation tests")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/of/unittest.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 939cbff45ab1..6bc5babddf0a 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -1250,6 +1250,7 @@ static void __init of_unittest_pci_empty_dma_ranges(void)
if (of_pci_dma_range_parser_init(&parser, np)) {
pr_err("missing dma-ranges property\n");
+ of_node_put(np);
return;
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] of: unittest: Fix np reference leak in of_unittest_pci_empty_dma_ranges()
2026-09-17 13:03 [PATCH] of: unittest: Fix np reference leak in of_unittest_pci_empty_dma_ranges() Wentao Liang
@ 2026-09-17 14:33 ` Andrea della Porta
0 siblings, 0 replies; 2+ messages in thread
From: Andrea della Porta @ 2026-09-17 14:33 UTC (permalink / raw)
To: Wentao Liang
Cc: andrea.porta, devicetree, linux-kernel, robh, saravanak, stable
Hi Wentao,
On 13:03 Thu 17 Sep , Wentao Liang wrote:
> of_pci_dma_range_parser_init() can fail when the node lacks a dma-ranges
> property. That error path returns without dropping the reference taken
> by of_find_node_by_path(). Add the missing of_node_put().
>
> Fixes: 1a75e81baf4f ("of/unittest: Add empty dma-ranges address translation tests")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/of/unittest.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index 939cbff45ab1..6bc5babddf0a 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -1250,6 +1250,7 @@ static void __init of_unittest_pci_empty_dma_ranges(void)
>
> if (of_pci_dma_range_parser_init(&parser, np)) {
> pr_err("missing dma-ranges property\n");
> + of_node_put(np);
> return;
> }
>
> --
> 2.34.1
>
Thanks for your patch!
Reviewed-by: Andrea della Porta <andrea.porta@suse.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-17 14:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 13:03 [PATCH] of: unittest: Fix np reference leak in of_unittest_pci_empty_dma_ranges() Wentao Liang
2026-09-17 14:33 ` Andrea della Porta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®