From: Wentao Liang <vulab@iscas.ac.cn>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Frank Li <Frank.Li@kernel.org>,
linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org,
vulab@iscas.ac.cn
Subject: Re: [PATCH] i3c: master: Fix of_node reference leak in i3c_master_register()
Date: Sun, 08 Nov 2026 09:28:40 +0000 [thread overview]
Message-ID: <20261108092840.314160-1-vulab@iscas.ac.cn> (raw)
In-Reply-To: <aqr19zvkGvMqRi2B@lizhi-Precision-Tower-5810>
Hi Frank,
Sorry for the very late reply.
Thank you for catching both problems. You are right, and I am sorry for
getting the API wrong in v1: the reference on the node is taken with
fwnode_handle_get(), so it has to be dropped with fwnode_handle_put().
of_node_put() only operates on Open Firmware nodes and is a no-op on ACPI
and software node systems, so the leak remained there.
On your second question: every other error branch in this function runs
after device_initialize(), and all of them end up at err_put_dev, where
put_device() calls i3c_masterdev_release() and that function drops the
fwnode with fwnode_handle_put(dev->fwnode). The i3c_master_rpm_get()
failure is the only path that returns before the device is initialized;
put_device() cannot be used there, so the reference has to be dropped
explicitly.
A v2 that calls fwnode_handle_put(dev_fwnode(&master->dev)), rebased on
current mainline, follows in a separate mail. I also dropped Cc: stable
there, since this only leaks on a registration failure path.
Thanks,
Wentao
prev parent reply other threads:[~2026-11-08 9:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 16:03 Wentao Liang
[not found] ` <20260916161616.7B6B31F000FF@smtp.kernel.org>
[not found] ` <aqr19zvkGvMqRi2B@lizhi-Precision-Tower-5810>
2026-11-08 9:28 ` Wentao Liang [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=20261108092840.314160-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=Frank.Li@kernel.org \
--cc=Frank.li@oss.nxp.com \
--cc=alexandre.belloni@bootlin.com \
--cc=linux-i3c@lists.infradead.org \
--cc=linux-kernel@vger.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®