diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2014-12-22 23:35:36 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-12-22 23:37:41 -0500 |
commit | 574732c73d155320f9358d9ee5d84beb0f4ecee2 (patch) | |
tree | 7ec0855efcbc207f6e226ab97f5da0bdaa2adb4c /kernel | |
parent | aa39477b5692611b91ac9455ae588738852b3f60 (diff) |
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: Sasha Levin <sasha.levin@oracle.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/params.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/params.c b/kernel/params.c index 0af9b2c4e56c..bd65d136a470 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -648,6 +648,8 @@ static __modinit int add_sysfs_param(struct module_kobject *mk, | |||
648 | /* Do not allow runtime DAC changes to make param writable. */ | 648 | /* Do not allow runtime DAC changes to make param writable. */ |
649 | if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0) | 649 | if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0) |
650 | mk->mp->attrs[mk->mp->num].mattr.store = param_attr_store; | 650 | mk->mp->attrs[mk->mp->num].mattr.store = param_attr_store; |
651 | else | ||
652 | mk->mp->attrs[mk->mp->num].mattr.store = NULL; | ||
651 | mk->mp->attrs[mk->mp->num].mattr.attr.name = (char *)name; | 653 | mk->mp->attrs[mk->mp->num].mattr.attr.name = (char *)name; |
652 | mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm; | 654 | mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm; |
653 | mk->mp->num++; | 655 | mk->mp->num++; |