From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Miodrag Dinic <miodrag.dinic@mips.com>,
James Hogan <jhogan@kernel.org>,
Paul Burton <paulburton@kernel.org>,
Aleksandar Markovic <aleksandar.markovic@mips.com>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] MIPS: CPC: Fix refcount leak in mips_cpc_default_phys_base
Date: Mon, 23 May 2022 11:18:27 +0200 [thread overview]
Message-ID: <20220523091827.GE5069@alpha.franken.de> (raw)
In-Reply-To: <20220516043353.8147-1-linmq006@gmail.com>
On Mon, May 16, 2022 at 08:33:50AM +0400, Miaoqian Lin wrote:
> of_find_compatible_node() 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: 791412dafbbf ("MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base()")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> arch/mips/kernel/mips-cpc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c
> index 17aff13cd7ce..3e386f7e1545 100644
> --- a/arch/mips/kernel/mips-cpc.c
> +++ b/arch/mips/kernel/mips-cpc.c
> @@ -28,6 +28,7 @@ phys_addr_t __weak mips_cpc_default_phys_base(void)
> cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc");
> if (cpc_node) {
> err = of_address_to_resource(cpc_node, 0, &res);
> + of_node_put(cpc_node);
> if (!err)
> return res.start;
> }
> --
> 2.25.1
this is already fixed in mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
next prev parent reply other threads:[~2022-05-23 9:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 4:33 [PATCH] MIPS: CPC: Fix refcount leak in mips_cpc_default_phys_base Miaoqian Lin
2022-05-23 9:18 ` Thomas Bogendoerfer [this message]
2022-05-23 13:16 ` Serge Semin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220523091827.GE5069@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=aleksandar.markovic@mips.com \
--cc=geert+renesas@glider.be \
--cc=jhogan@kernel.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=miodrag.dinic@mips.com \
--cc=paulburton@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.