From: "Danilo Krummrich" <dakr@kernel.org>
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Johan Hovold" <johan@kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Daniel Scally" <djrscally@gmail.com>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Bartosz Golaszewski" <brgl@kernel.org>,
<driver-core@lists.linux.dev>, <linux-acpi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 1/3] driver core: swnode: only release owned secondary software nodes
Date: Sun, 06 Dec 2026 00:03:54 +0100 [thread overview]
Message-ID: <DND6ANHABYLV.2KXFHPR0YSA58@kernel.org> (raw)
In-Reply-To: <20261202-swnode-shared-primary-fix-v1-1-7ff23caaa1ed@gmail.com>
On Thu Dec 3, 2026 at 2:34 AM CET, Dmitry Torokhov wrote:
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 44f79f427b6b..673dc5941019 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -5250,12 +5250,19 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
> dev->fwnode = fwnode;
> } else {
> if (fwnode_is_primary(fn)) {
> - dev->fwnode = fn->secondary;
> -
> - /* Skip nullifying fn->secondary if the primary is shared */
> - if (parent && fn == parent->fwnode)
> + /*
> + * If the primary fwnode is shared with the parent and
> + * this device did not attach the secondary node, clear
> + * dev->fwnode without leaving it pointing to the
> + * parent's secondary node or modifying fn->secondary.
> + */
> + if (parent && fn == parent->fwnode &&
> + !dev_swnode_added(dev)) {
> + dev->fwnode = NULL;
> return;
> + }
I think the Sashiko report [1] is valid (though it was present before this patch
as well).
I think we need to preserve the borrowed secondary when detaching a non-shared
primary, and ensure device release drops only references the device actually
owns.
[1] https://sashiko.dev/#/patchset/20261202-swnode-shared-primary-fix-v1-0-7ff23caaa1ed%40gmail.com
next prev parent reply other threads:[~2026-12-05 23:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 1:34 [PATCH 0/3] driver core: swnode: fix release with shared primary fwnode Dmitry Torokhov
2026-12-03 1:34 ` [PATCH 1/3] driver core: swnode: only release owned secondary software nodes Dmitry Torokhov
2026-12-05 23:03 ` Danilo Krummrich [this message]
2026-12-03 1:34 ` [PATCH 2/3] software node: replace owner pointer with managed bitfield Dmitry Torokhov
2026-12-03 1:34 ` [PATCH 3/3] driver core: platform: tests: add shared primary fwnode swnode tests Dmitry Torokhov
2026-12-03 11:35 ` [PATCH 0/3] driver core: swnode: fix release with shared primary fwnode Andy Shevchenko
2026-12-05 21:00 ` Cesar Cibrian
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=DND6ANHABYLV.2KXFHPR0YSA58@kernel.org \
--to=dakr@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=djrscally@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=johan@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stable@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 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.