* [PATCH] sparc32,leon: Fix reference leak in leon_ipi_init
@ 2022-06-05 5:29 Miaoqian Lin
2022-06-05 7:48 ` Sam Ravnborg
0 siblings, 1 reply; 3+ messages in thread
From: Miaoqian Lin @ 2022-06-05 5:29 UTC (permalink / raw)
To: David S. Miller, Miaoqian Lin, Daniel Hellstrom, sparclinux,
linux-kernel
of_find_node_by_path() returns a node pointer with
refcount incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.
Fixes: 1ca0c808c60f ("sparc32,leon: Implemented SMP IPIs for LEON CPU")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
arch/sparc/kernel/leon_smp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1eed26d423fb..85b22669c002 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -284,6 +284,7 @@ static void __init leon_ipi_init(void)
pp = of_find_property(rootnp, "ipi_num", &len);
if (pp && (*(int *)pp->value))
leon_ipi_irq = *(int *)pp->value;
+ of_node_put(rootnp);
}
printk(KERN_INFO "leon: SMP IPIs at IRQ %d\n", leon_ipi_irq);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sparc32,leon: Fix reference leak in leon_ipi_init
2022-06-05 5:29 [PATCH] sparc32,leon: Fix reference leak in leon_ipi_init Miaoqian Lin
@ 2022-06-05 7:48 ` Sam Ravnborg
2022-06-05 9:02 ` Miaoqian Lin
0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2022-06-05 7:48 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: David S. Miller, Daniel Hellstrom, sparclinux, linux-kernel
On Sun, Jun 05, 2022 at 09:29:41AM +0400, Miaoqian Lin wrote:
> of_find_node_by_path() returns a node pointer with
> refcount incremented, we should use of_node_put() on it when done.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: 1ca0c808c60f ("sparc32,leon: Implemented SMP IPIs for LEON CPU")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
The patch is finei, thanks:
Acked-by: Sam Ravnborg <sam@ravnborg.org>
All other uses of of_find_node_by_path() in sparc has the same issue.
Could you try to take a look at the rest too?
Sam
> ---
> arch/sparc/kernel/leon_smp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
> index 1eed26d423fb..85b22669c002 100644
> --- a/arch/sparc/kernel/leon_smp.c
> +++ b/arch/sparc/kernel/leon_smp.c
> @@ -284,6 +284,7 @@ static void __init leon_ipi_init(void)
> pp = of_find_property(rootnp, "ipi_num", &len);
> if (pp && (*(int *)pp->value))
> leon_ipi_irq = *(int *)pp->value;
> + of_node_put(rootnp);
> }
> printk(KERN_INFO "leon: SMP IPIs at IRQ %d\n", leon_ipi_irq);
>
> --
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sparc32,leon: Fix reference leak in leon_ipi_init
2022-06-05 7:48 ` Sam Ravnborg
@ 2022-06-05 9:02 ` Miaoqian Lin
0 siblings, 0 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-06-05 9:02 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: David S. Miller, Daniel Hellstrom, sparclinux, linux-kernel
On 2022/6/5 15:48, Sam Ravnborg wrote:
> On Sun, Jun 05, 2022 at 09:29:41AM +0400, Miaoqian Lin wrote:
>> of_find_node_by_path() returns a node pointer with
>> refcount incremented, we should use of_node_put() on it when done.
>> Add missing of_node_put() to avoid refcount leak.
>>
>> Fixes: 1ca0c808c60f ("sparc32,leon: Implemented SMP IPIs for LEON CPU")
>> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> The patch is finei, thanks:
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>
> All other uses of of_find_node_by_path() in sparc has the same issue.
> Could you try to take a look at the rest too?
Sure, I will look into them.
> Sam
>> ---
>> arch/sparc/kernel/leon_smp.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
>> index 1eed26d423fb..85b22669c002 100644
>> --- a/arch/sparc/kernel/leon_smp.c
>> +++ b/arch/sparc/kernel/leon_smp.c
>> @@ -284,6 +284,7 @@ static void __init leon_ipi_init(void)
>> pp = of_find_property(rootnp, "ipi_num", &len);
>> if (pp && (*(int *)pp->value))
>> leon_ipi_irq = *(int *)pp->value;
>> + of_node_put(rootnp);
>> }
>> printk(KERN_INFO "leon: SMP IPIs at IRQ %d\n", leon_ipi_irq);
>>
>> --
>> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-05 9:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05 5:29 [PATCH] sparc32,leon: Fix reference leak in leon_ipi_init Miaoqian Lin
2022-06-05 7:48 ` Sam Ravnborg
2022-06-05 9:02 ` Miaoqian Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).