[PATCH] fix kernel oops with badly formatted module option
authorRandy Dunlap <[email protected]>
Thu, 12 Apr 2007 06:28:41 +0000 (23:28 -0700)
committerLinus Torvalds <[email protected]>
Thu, 12 Apr 2007 22:31:41 +0000 (15:31 -0700)
Catch malformed kernel parameter usage of "param = value".  Spaces are not
supported, but don't cause a kernel fault on such usage, just report an
error.

Signed-off-by: Randy Dunlap <[email protected]>
Acked-by: Larry Finger <[email protected]>
Acked-by: Rusty Russell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/params.c

index e265b13195b165164f3f9f59d6880b560502c89e..1fc4ac746cd8b7c5f9fd9310741beee1397f8c9b 100644 (file)
@@ -356,6 +356,10 @@ int param_set_copystring(const char *val, struct kernel_param *kp)
 {
        struct kparam_string *kps = kp->arg;
 
+       if (!val) {
+               printk(KERN_ERR "%s: missing param set value\n", kp->name);
+               return -EINVAL;
+       }
        if (strlen(val)+1 > kps->maxlen) {
                printk(KERN_ERR "%s: string doesn't fit in %u chars.\n",
                       kp->name, kps->maxlen-1);