From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Leo Cheng <leo-cheng@vip.qq.com>
Cc: Srinivas Kandagatla <srini@kernel.org>,
Michael Walle <mwalle@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] nvmem: layouts: sl28vpd: fix device_node reference leak in error path
Date: Tue, 11 Aug 2026 16:38:05 +0200 [thread overview]
Message-ID: <87ecg4oh82.fsf@bootlin.com> (raw)
In-Reply-To: <tencent_65156571568C9E4076E52D1825CC5F476A08@qq.com> (Leo Cheng's message of "Tue, 11 Aug 2026 20:55:48 +0800")
On 11/08/2026 at 20:55:48 +08, Leo Cheng <leo-cheng@vip.qq.com> 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: Miquel Raynal <miquel.raynal@bootlin.com>
next prev parent reply other threads:[~2026-08-11 14:38 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 [this message]
2026-08-12 6:21 ` Michael Walle
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=87ecg4oh82.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=leo-cheng@vip.qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mwalle@kernel.org \
--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