Skip to content

Commit 574732c

Browse files
committed
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 <[email protected]> Cc: Kees Cook <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
1 parent aa39477 commit 574732c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/params.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ static __modinit int add_sysfs_param(struct module_kobject *mk,
648648
/* Do not allow runtime DAC changes to make param writable. */
649649
if ((kp->perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0)
650650
mk->mp->attrs[mk->mp->num].mattr.store = param_attr_store;
651+
else
652+
mk->mp->attrs[mk->mp->num].mattr.store = NULL;
651653
mk->mp->attrs[mk->mp->num].mattr.attr.name = (char *)name;
652654
mk->mp->attrs[mk->mp->num].mattr.attr.mode = kp->perm;
653655
mk->mp->num++;

0 commit comments

Comments
 (0)