mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 09:02:00 +00:00
[PATCH] Fix IPMI watchdog set_param_str() using kstrdup
set_param_str() cannot use kstrdup() to duplicate the parameter. That's fine when the driver is compiled as a module but it sure is not when built into the kernel as the kernel parameters are parsed before the kmalloc slabs are setup. Signed-off-by: Sebastien Dugué <sebastien.dugue@bull.net> Acked-by: Corey Minyard <minyard@acm.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
7479b1ce5e
commit
43cdff92ad
@ -216,13 +216,13 @@ static int set_param_str(const char *val, struct kernel_param *kp)
|
||||
{
|
||||
action_fn fn = (action_fn) kp->arg;
|
||||
int rv = 0;
|
||||
char *dup, *s;
|
||||
char valcp[16];
|
||||
char *s;
|
||||
|
||||
dup = kstrdup(val, GFP_KERNEL);
|
||||
if (!dup)
|
||||
return -ENOMEM;
|
||||
strncpy(valcp, val, 16);
|
||||
valcp[15] = '\0';
|
||||
|
||||
s = strstrip(dup);
|
||||
s = strstrip(valcp);
|
||||
|
||||
down_read(®ister_sem);
|
||||
rv = fn(s, NULL);
|
||||
@ -235,7 +235,6 @@ static int set_param_str(const char *val, struct kernel_param *kp)
|
||||
|
||||
out_unlock:
|
||||
up_read(®ister_sem);
|
||||
kfree(dup);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user