From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Liang He <windhl@126.com>,
mpe@ellerman.id.au, paulus@samba.org,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/powermac/udbg_scc: Fix refcount leak bug in udbg_scc_init()
Date: Tue, 02 Aug 2022 14:50:32 +1000 [thread overview]
Message-ID: <9fb802d118eca207ffb887201b7b12970b054a27.camel@kernel.crashing.org> (raw)
In-Reply-To: <20220716074344.540049-1-windhl@126.com>
On Sat, 2022-07-16 at 15:43 +0800, Liang He wrote:
> During the iteration of for_each_child_of_node(), we need to call
> of_node_put() for the old references stored in to 'ch_def' and 'ch_a'
> as their refcounters have been increased in last iteration.
None of these matter since those nodes are never *ever* released and
those machines don't use dynamic node allocation but ...
> Fixes: 51d3082fe6e5 ("[PATCH] powerpc: Unify udbg (#2)")
> Signed-off-by: Liang He <windhl@126.com>
> ---
> arch/powerpc/platforms/powermac/udbg_scc.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c
> b/arch/powerpc/platforms/powermac/udbg_scc.c
> index 734df5a32f99..1b7c39e841ee 100644
> --- a/arch/powerpc/platforms/powermac/udbg_scc.c
> +++ b/arch/powerpc/platforms/powermac/udbg_scc.c
> @@ -81,10 +81,14 @@ void __init udbg_scc_init(int force_scc)
> if (path != NULL)
> stdout = of_find_node_by_path(path);
> for_each_child_of_node(escc, ch) {
> - if (ch == stdout)
> + if (ch == stdout) {
> + of_node_put(ch_def);
> ch_def = of_node_get(ch);
> - if (of_node_name_eq(ch, "ch-a"))
> + }
> + if (of_node_name_eq(ch, "ch-a")) {
> + of_node_put(ch_a);
> ch_a = of_node_get(ch);
> + }
> }
> if (ch_def == NULL && !force_scc)
> goto bail;
next prev parent reply other threads:[~2022-08-02 4:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-16 7:43 [PATCH] powerpc/powermac/udbg_scc: Fix refcount leak bug in udbg_scc_init() Liang He
2022-08-02 4:50 ` Benjamin Herrenschmidt [this message]
2022-09-09 12:07 ` Michael Ellerman
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=9fb802d118eca207ffb887201b7b12970b054a27.camel@kernel.crashing.org \
--to=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=windhl@126.com \
/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 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).