Re: [PATCH 3/4] software node: verify that property data is not on stack

From: Dmitry Torokhov

Date: Tue Mar 24 2026 - 12:25:14 EST


On Tue, Mar 24, 2026 at 02:33:31PM +0200, Andy Shevchenko wrote:
> On Mon, Mar 23, 2026 at 05:39:39PM -0700, Dmitry Torokhov wrote:
> > 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.
>
> ...
>
> > +#include <linux/sched/task_stack.h>
>
> Looking at this name the use of it here doesn't sound right...

Because ... ? object_is_on_stack() is defined there.

>
> ...
>
> > + 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;
> > + }
> > + }
>
> And again same question, why we can't simply dup them as we do for (string)
> arrays?

Because majority of users of software_node_register() deal with static
const properties so duping them is waste of memory.

Thanks.

--
Dmitry