From: "Michael Walle" <mwalle@kernel.org>
To: "Leo Cheng" <leo-cheng@vip.qq.com>,
"Srinivas Kandagatla" <srini@kernel.org>,
"Miquel Raynal" <miquel.raynal@bootlin.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] nvmem: layouts: onie-tlv: fix device_node reference leak in error path
Date: Wed, 12 Aug 2026 08:22:52 +0200 [thread overview]
Message-ID: <DKMQZJPJ7UWT.3OB99A1TPAUNJ@kernel.org> (raw)
In-Reply-To: <tencent_795E00A994EB63D831671DBD55A4C689310A@qq.com>
On Tue Aug 11, 2026 at 2:55 PM CEST, Leo Cheng wrote:
> onie_tlv_add_cells() takes a reference on the child node via
> of_get_child_by_name() for each parsed TLV and passes it to
> nvmem_add_one_cell() as cell.np. On success the created cell entry
> adopts that reference and releases it later via of_node_put(); on
> failure nvmem_add_one_cell() does not consume it, so the caller still
> owns it, but the error path only puts layout before returning, leaking
> the child node reference.
>
> Put cell.np on the error path as well. of_node_put(NULL) is a no-op, so
> this is safe even when of_get_child_by_name() returned NULL.
>
> Fixes: d3c0d12f6474 ("nvmem: layouts: onie-tlv: Add new layout driver")
> Signed-off-by: Leo Cheng <leo-cheng@vip.qq.com>
Reviewed-by: Michael Walle <mwalle@kernel.org>
prev parent reply other threads:[~2026-08-12 6:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 12:55 Leo Cheng
2026-08-12 6:22 ` Michael Walle [this message]
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=DKMQZJPJ7UWT.3OB99A1TPAUNJ@kernel.org \
--to=mwalle@kernel.org \
--cc=leo-cheng@vip.qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=srini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®