linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
@ 2022-03-09  9:17 Miaoqian Lin
  2022-03-11 14:29 ` Serge Semin
  2022-03-14 14:52 ` Thomas Bogendoerfer
  0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-03-09  9:17 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Serge Semin, linux-mips, linux-kernel; +Cc: linmq006

The of_find_compatible_node() function returns a node pointer with
refcount incremented, We should use of_node_put() on it when done
Add the missing of_node_put() to release the refcount.

Fixes: 2121aa3e2312 ("mips: cdmm: Add mti,mips-cdmm dtb node support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/bus/mips_cdmm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c
index 626dedd110cb..fca0d0669aa9 100644
--- a/drivers/bus/mips_cdmm.c
+++ b/drivers/bus/mips_cdmm.c
@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void)
 	np = of_find_compatible_node(NULL, NULL, "mti,mips-cdmm");
 	if (np) {
 		err = of_address_to_resource(np, 0, &res);
+		of_node_put(np);
 		if (!err)
 			return res.start;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
  2022-03-09  9:17 [PATCH] mips: cdmm: Fix refcount leak in mips_cdmm_phys_base Miaoqian Lin
@ 2022-03-11 14:29 ` Serge Semin
  2022-03-14 14:52 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Serge Semin @ 2022-03-11 14:29 UTC (permalink / raw)
  To: Miaoqian Lin; +Cc: Serge Semin, Thomas Bogendoerfer, linux-mips, linux-kernel

On Wed, Mar 09, 2022 at 09:17:10AM +0000, Miaoqian Lin wrote:
> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> Fixes: 2121aa3e2312 ("mips: cdmm: Add mti,mips-cdmm dtb node support")

Nice catch. Thanks.

Acked-by: Serge Semin <fancer.lancer@gmail.com>

> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/bus/mips_cdmm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c
> index 626dedd110cb..fca0d0669aa9 100644
> --- a/drivers/bus/mips_cdmm.c
> +++ b/drivers/bus/mips_cdmm.c
> @@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void)
>  	np = of_find_compatible_node(NULL, NULL, "mti,mips-cdmm");
>  	if (np) {
>  		err = of_address_to_resource(np, 0, &res);
> +		of_node_put(np);
>  		if (!err)
>  			return res.start;
>  	}
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
  2022-03-09  9:17 [PATCH] mips: cdmm: Fix refcount leak in mips_cdmm_phys_base Miaoqian Lin
  2022-03-11 14:29 ` Serge Semin
@ 2022-03-14 14:52 ` Thomas Bogendoerfer
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2022-03-14 14:52 UTC (permalink / raw)
  To: Miaoqian Lin; +Cc: Serge Semin, linux-mips, linux-kernel

On Wed, Mar 09, 2022 at 09:17:10AM +0000, Miaoqian Lin wrote:
> The of_find_compatible_node() function returns a node pointer with
> refcount incremented, We should use of_node_put() on it when done
> Add the missing of_node_put() to release the refcount.
> 
> Fixes: 2121aa3e2312 ("mips: cdmm: Add mti,mips-cdmm dtb node support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
>  drivers/bus/mips_cdmm.c | 1 +
>  1 file changed, 1 insertion(+)

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-14 14:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-09  9:17 [PATCH] mips: cdmm: Fix refcount leak in mips_cdmm_phys_base Miaoqian Lin
2022-03-11 14:29 ` Serge Semin
2022-03-14 14:52 ` Thomas Bogendoerfer

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).