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 1/2] nvmem: layouts: sl28vpd: fix device_node reference leak in error path
Date: Wed, 12 Aug 2026 08:21:42 +0200 [thread overview]
Message-ID: <DKMQYNUEZ0MI.2SL06ZC3SCL7V@kernel.org> (raw)
In-Reply-To: <tencent_65156571568C9E4076E52D1825CC5F476A08@qq.com>
On Tue Aug 11, 2026 at 2:55 PM CEST, Leo Cheng wrote:
> sl28vpd_add_cells() takes a reference on the child node via
> of_get_child_by_name() for each entry and passes it to
> nvmem_add_one_cell() as info.np. On success the created cell entry
> adopts that reference and releases it later via of_node_put() when the
> entry is torn down; nvmem_add_one_cell() does not take its own
> reference. On failure it does not consume the reference either, so the
> caller still owns it, but the error path only puts layout_np before
> returning, leaking the child node reference.
>
> Put info.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: d9fae023fe86 ("nvmem: layouts: sl28vpd: 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:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 12:55 [PATCH 1/2] nvmem: layouts: sl28vpd: fix device_node reference leak in error path Leo Cheng
2026-08-11 14:38 ` Miquel Raynal
2026-08-12 6:21 ` 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=DKMQYNUEZ0MI.2SL06ZC3SCL7V@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