From: Leon Romanovsky <leon@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Dave Ertman <david.m.ertman@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Jerome Brunet <jbrunet@baylibre.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver core: auxiliary bus: fix OF node leak
Date: Tue, 8 Jul 2025 12:59:08 +0300 [thread overview]
Message-ID: <20250708095908.GE592765@unreal> (raw)
In-Reply-To: <20250708084654.15145-1-johan@kernel.org>
On Tue, Jul 08, 2025 at 10:46:54AM +0200, Johan Hovold wrote:
> Make sure to drop the OF node reference taken when creating an auxiliary
> device using auxiliary_device_create() when the device is later
> released.
I'm probably missing something, but random grep for the
device_set_of_node_from_dev() callers shows that none of them are
calling to of_node_put() explicitly.
Thanks
>
> Fixes: eaa0d30216c1 ("driver core: auxiliary bus: add device creation helpers")
> Cc: Jerome Brunet <jbrunet@baylibre.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/base/auxiliary.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/base/auxiliary.c b/drivers/base/auxiliary.c
> index dba7c8e13a53..6bdefebf3609 100644
> --- a/drivers/base/auxiliary.c
> +++ b/drivers/base/auxiliary.c
> @@ -399,6 +399,7 @@ static void auxiliary_device_release(struct device *dev)
> {
> struct auxiliary_device *auxdev = to_auxiliary_dev(dev);
>
> + of_node_put(dev->of_node);
> kfree(auxdev);
> }
>
> @@ -435,6 +436,7 @@ struct auxiliary_device *auxiliary_device_create(struct device *dev,
>
> ret = auxiliary_device_init(auxdev);
> if (ret) {
> + of_node_put(auxdev->dev.of_node);
> kfree(auxdev);
> return NULL;
> }
> --
> 2.49.0
>
next prev parent reply other threads:[~2025-07-08 9:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-08 8:46 [PATCH] driver core: auxiliary bus: fix OF node leak Johan Hovold
2025-07-08 9:59 ` Leon Romanovsky [this message]
2025-07-08 10:04 ` Johan Hovold
2025-07-08 14:38 ` Jerome Brunet
2025-07-08 14:39 ` Danilo Krummrich
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=20250708095908.GE592765@unreal \
--to=leon@kernel.org \
--cc=dakr@kernel.org \
--cc=david.m.ertman@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ira.weiny@intel.com \
--cc=jbrunet@baylibre.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.