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

From: Andy Shevchenko

Date: Mon Mar 30 2026 - 06:37:10 EST


On Sun, Mar 29, 2026 at 07:27:50PM -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.

...

> + for (prop = node->properties; prop && prop->name; prop++) {
> + if (!prop->is_inline && object_is_on_stack(prop->pointer)) {

I read more about this... Any code that uses vmalloc() (or potentially may
switch to it from regular allocator with help of kvalloc() and similar) will
fail now. While it might be no issue right now, this may become a such. So
with this check in place you put a requirement that properties can only be
allocated from a kernel low memory heap and not vm.

> + pr_err("%s: property data can't be on stack ('%s')\n",
> + __func__, prop->name);
> + return -EINVAL;
> + }
> + }

--
With Best Regards,
Andy Shevchenko