From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, Hans de Goede <hansg@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@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>
Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
driver-core@lists.linux.dev
Subject: [PATCH 3/4] software node: verify that property data is not on stack
Date: Mon, 23 Mar 2026 17:39:39 -0700 [thread overview]
Message-ID: <20260323-property-gpio-fix-v1-3-9cb46e5fe7df@gmail.com> (raw)
In-Reply-To: <20260323-property-gpio-fix-v1-0-9cb46e5fe7df@gmail.com>
When registering a software node, ensure that the property data is not
located on the stack, as it is expected to persist for the lifetime of
the node.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/base/swnode.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 51320837f3a9..45c319a08eb6 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -16,6 +16,7 @@
#include <linux/kstrtox.h>
#include <linux/list.h>
#include <linux/property.h>
+#include <linux/sched/task_stack.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
@@ -917,6 +918,7 @@ EXPORT_SYMBOL_GPL(software_node_unregister_node_group);
int software_node_register(const struct software_node *node)
{
struct swnode *parent = software_node_to_swnode(node->parent);
+ const struct property_entry *prop;
if (software_node_to_swnode(node))
return -EEXIST;
@@ -924,6 +926,13 @@ int software_node_register(const struct software_node *node)
if (node->parent && !parent)
return -EINVAL;
+ for (prop = node->properties; prop && prop->name; prop++) {
+ if (!prop->is_inline && object_is_on_stack(prop->pointer)) {
+ pr_err("%s: property data can't be on stack\n", __func__);
+ return -EINVAL;
+ }
+ }
+
return PTR_ERR_OR_ZERO(swnode_register(node, parent, 0));
}
EXPORT_SYMBOL_GPL(software_node_register);
--
2.53.0.1018.g2bb0e51243-goog
next prev parent reply other threads:[~2026-03-24 0:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 0:39 [PATCH 0/4] Fix handling of GPIO keys and LEDs on geode Dmitry Torokhov
2026-03-24 0:39 ` [PATCH 1/4] x86/geode: fix on-stack property data usage Dmitry Torokhov
2026-03-24 0:39 ` [PATCH 2/4] software node: allow passing reference args to PROPERTY_ENTRY_REF Dmitry Torokhov
2026-03-24 12:30 ` Andy Shevchenko
2026-03-24 16:12 ` Dmitry Torokhov
2026-03-24 0:39 ` Dmitry Torokhov [this message]
2026-03-24 12:33 ` [PATCH 3/4] software node: verify that property data is not on stack Andy Shevchenko
2026-03-24 16:17 ` Dmitry Torokhov
2026-03-25 11:51 ` Andy Shevchenko
2026-03-25 16:24 ` Dmitry Torokhov
2026-03-26 11:19 ` Andy Shevchenko
2026-03-24 0:39 ` [PATCH 4/4] x86/geode: use PROPERTY_ENTRY_REF for GPIO properties Dmitry Torokhov
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=20260323-property-gpio-fix-v1-3-9cb46e5fe7df@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bp@alien8.de \
--cc=dakr@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=djrscally@gmail.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=tglx@kernel.org \
--cc=x86@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®