* [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing
@ 2022-06-05 6:00 Miaoqian Lin
2022-06-07 9:05 ` Frederic Barrat
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-06-05 6:00 UTC (permalink / raw)
To: Frederic Barrat, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, Michael Ellerman, Christophe Lombard,
linuxppc-dev, linux-kernel
Cc: linmq006
of_get_next_parent() returns a node pointer with refcount incremented,
we should use of_node_put() on it when not need anymore.
This function only calls of_node_put() in normal path,
missing it in the error path.
Add missing of_node_put() to avoid refcount leak.
Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/misc/cxl/pci.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 3de0aea62ade..62385a529d86 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -387,6 +387,7 @@ int cxl_calc_capp_routing(struct pci_dev *dev, u64 *chipid,
rc = get_phb_index(np, phb_index);
if (rc) {
pr_err("cxl: invalid phb index\n");
+ of_node_put(np);
return rc;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing
2022-06-05 6:00 [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing Miaoqian Lin
@ 2022-06-07 9:05 ` Frederic Barrat
2022-06-14 10:12 ` Andrew Donnellan
2022-11-30 9:23 ` Michael Ellerman
2 siblings, 0 replies; 6+ messages in thread
From: Frederic Barrat @ 2022-06-07 9:05 UTC (permalink / raw)
To: Miaoqian Lin, Andrew Donnellan, Arnd Bergmann,
Greg Kroah-Hartman, Michael Ellerman, Christophe Lombard,
linuxppc-dev, linux-kernel
On 05/06/2022 08:00, Miaoqian Lin wrote:
> of_get_next_parent() returns a node pointer with refcount incremented,
> we should use of_node_put() on it when not need anymore.
> This function only calls of_node_put() in normal path,
> missing it in the error path.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Indeed. Thanks!
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Fred
> ---
> drivers/misc/cxl/pci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
> index 3de0aea62ade..62385a529d86 100644
> --- a/drivers/misc/cxl/pci.c
> +++ b/drivers/misc/cxl/pci.c
> @@ -387,6 +387,7 @@ int cxl_calc_capp_routing(struct pci_dev *dev, u64 *chipid,
> rc = get_phb_index(np, phb_index);
> if (rc) {
> pr_err("cxl: invalid phb index\n");
> + of_node_put(np);
> return rc;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing
2022-06-05 6:00 [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing Miaoqian Lin
2022-06-07 9:05 ` Frederic Barrat
@ 2022-06-14 10:12 ` Andrew Donnellan
2022-11-14 12:42 ` Christophe Leroy
2022-11-30 9:23 ` Michael Ellerman
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Donnellan @ 2022-06-14 10:12 UTC (permalink / raw)
To: Miaoqian Lin, Frederic Barrat, Arnd Bergmann, Greg Kroah-Hartman,
Michael Ellerman, Christophe Lombard, linuxppc-dev, linux-kernel
On Sun, 2022-06-05 at 10:00 +0400, Miaoqian Lin wrote:
> of_get_next_parent() returns a node pointer with refcount
> incremented,
> we should use of_node_put() on it when not need anymore.
> This function only calls of_node_put() in normal path,
> missing it in the error path.
> Add missing of_node_put() to avoid refcount leak.
>
> Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Thanks!
Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
> ---
> drivers/misc/cxl/pci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
> index 3de0aea62ade..62385a529d86 100644
> --- a/drivers/misc/cxl/pci.c
> +++ b/drivers/misc/cxl/pci.c
> @@ -387,6 +387,7 @@ int cxl_calc_capp_routing(struct pci_dev *dev,
> u64 *chipid,
> rc = get_phb_index(np, phb_index);
> if (rc) {
> pr_err("cxl: invalid phb index\n");
> + of_node_put(np);
> return rc;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing
2022-06-14 10:12 ` Andrew Donnellan
@ 2022-11-14 12:42 ` Christophe Leroy
2022-11-22 5:39 ` Andrew Donnellan
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2022-11-14 12:42 UTC (permalink / raw)
To: Andrew Donnellan, Miaoqian Lin, Frederic Barrat, Arnd Bergmann,
Greg Kroah-Hartman, Michael Ellerman, Christophe Lombard,
linuxppc-dev, linux-kernel, Bjorn Helgaas
Should this be applied by Bjorn as most recent changes to that file ?
Le 14/06/2022 à 12:12, Andrew Donnellan a écrit :
> On Sun, 2022-06-05 at 10:00 +0400, Miaoqian Lin wrote:
>> of_get_next_parent() returns a node pointer with refcount
>> incremented,
>> we should use of_node_put() on it when not need anymore.
>> This function only calls of_node_put() in normal path,
>> missing it in the error path.
>> Add missing of_node_put() to avoid refcount leak.
>>
>> Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
>> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
>
> Thanks!
>
> Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
>
>> ---
>> drivers/misc/cxl/pci.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
>> index 3de0aea62ade..62385a529d86 100644
>> --- a/drivers/misc/cxl/pci.c
>> +++ b/drivers/misc/cxl/pci.c
>> @@ -387,6 +387,7 @@ int cxl_calc_capp_routing(struct pci_dev *dev,
>> u64 *chipid,
>> rc = get_phb_index(np, phb_index);
>> if (rc) {
>> pr_err("cxl: invalid phb index\n");
>> + of_node_put(np);
>> return rc;
>> }
>>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing
2022-11-14 12:42 ` Christophe Leroy
@ 2022-11-22 5:39 ` Andrew Donnellan
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Donnellan @ 2022-11-22 5:39 UTC (permalink / raw)
To: Christophe Leroy, Miaoqian Lin, Frederic Barrat, Arnd Bergmann,
Greg Kroah-Hartman, Michael Ellerman, Christophe Lombard,
linuxppc-dev, linux-kernel, Bjorn Helgaas
On Mon, 2022-11-14 at 12:42 +0000, Christophe Leroy wrote:
> Should this be applied by Bjorn as most recent changes to that file ?
We usually take cxl patches through powerpc, though sometimes Greg
picks them up through char-misc.
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing
2022-06-05 6:00 [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing Miaoqian Lin
2022-06-07 9:05 ` Frederic Barrat
2022-06-14 10:12 ` Andrew Donnellan
@ 2022-11-30 9:23 ` Michael Ellerman
2 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2022-11-30 9:23 UTC (permalink / raw)
To: Miaoqian Lin, Michael Ellerman, Greg Kroah-Hartman,
Frederic Barrat, linux-kernel, Christophe Lombard,
Andrew Donnellan, Arnd Bergmann, linuxppc-dev
On Sun, 5 Jun 2022 10:00:38 +0400, Miaoqian Lin wrote:
> of_get_next_parent() returns a node pointer with refcount incremented,
> we should use of_node_put() on it when not need anymore.
> This function only calls of_node_put() in normal path,
> missing it in the error path.
> Add missing of_node_put() to avoid refcount leak.
>
>
> [...]
Applied to powerpc/next.
[1/1] cxl: Fix refcount leak in cxl_calc_capp_routing
https://git.kernel.org/powerpc/c/1d09697ff22908ae487fc8c4fbde1811732be523
cheers
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-30 9:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05 6:00 [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing Miaoqian Lin
2022-06-07 9:05 ` Frederic Barrat
2022-06-14 10:12 ` Andrew Donnellan
2022-11-14 12:42 ` Christophe Leroy
2022-11-22 5:39 ` Andrew Donnellan
2022-11-30 9:23 ` Michael Ellerman
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).