Commit 574732c7 authored by Rusty Russell's avatar Rusty Russell

param: initialize store function to NULL if not available.

I rebased Kees' 'param: do not set store func without write perm'
on top of my 'params: cleanup sysfs allocation'.  However, my patch
uses krealloc which doesn't zero memory, leaving .store unset.
Reported-by: default avatarSasha Levin <sasha.levin@oracle.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent aa39477b
...@@ -648,6 +648,8 @@ static __modinit int add_sysfs_param(struct module_kobject *mk, ...@@ -648,6 +648,8 @@ static __modinit int add_sysfs_param(struct module_kobject *mk,
/* Do not allow runtime DAC changes to make param writable. */ /* Do not allow runtime DAC changes to make param writable. */
if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0) if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0)
mk->mp->attrs[mk->mp->num].mattr.store = param_attr_store; mk->mp->attrs[mk->mp->num].mattr.store = param_attr_store;
else
mk->mp->attrs[mk->mp->num].mattr.store = NULL;
mk->mp->attrs[mk->mp->num].mattr.attr.name = (char *)name; mk->mp->attrs[mk->mp->num].mattr.attr.name = (char *)name;
mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm; mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm;
mk->mp->num++; mk->mp->num++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment