Commit 43cdff92 authored by Sebastien Dugué's avatar Sebastien Dugué Committed by Linus Torvalds

[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: default avatarSebastien Dugué <sebastien.dugue@bull.net>
Acked-by: default avatarCorey Minyard <minyard@acm.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7479b1ce
...@@ -216,13 +216,13 @@ static int set_param_str(const char *val, struct kernel_param *kp) ...@@ -216,13 +216,13 @@ static int set_param_str(const char *val, struct kernel_param *kp)
{ {
action_fn fn = (action_fn) kp->arg; action_fn fn = (action_fn) kp->arg;
int rv = 0; int rv = 0;
char *dup, *s; char valcp[16];
char *s;
dup = kstrdup(val, GFP_KERNEL); strncpy(valcp, val, 16);
if (!dup) valcp[15] = '\0';
return -ENOMEM;
s = strstrip(dup); s = strstrip(valcp);
down_read(&register_sem); down_read(&register_sem);
rv = fn(s, NULL); rv = fn(s, NULL);
...@@ -235,7 +235,6 @@ static int set_param_str(const char *val, struct kernel_param *kp) ...@@ -235,7 +235,6 @@ static int set_param_str(const char *val, struct kernel_param *kp)
out_unlock: out_unlock:
up_read(&register_sem); up_read(&register_sem);
kfree(dup);
return rv; return rv;
} }
......
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