[PATCH] fix kernel oops with badly formatted module option
authorRandy Dunlap <randy.dunlap@oracle.com>
Thu, 12 Apr 2007 06:28:41 +0000 (23:28 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
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 <randy.dunlap@oracle.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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);