diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2013-07-02 02:05:12 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-07-02 02:08:21 -0400 |
commit | 54041d8a73337411b485ff76957fb106cb5d40d0 (patch) | |
tree | d80e16306e28cc2821794be56b37c5e64b091fa5 | |
parent | 86f120031a21fe4e7333a84f55d9e243c781e6e9 (diff) |
modules: don't fail to load on unknown parameters.
Although parameters are supposed to be part of the kernel API, experimental
parameters are often removed. In addition, downgrading a kernel might cause
previously-working modules to fail to load.
On balance, it's probably better to warn, and load the module anyway.
This may let through a typo, but at least the logs will show it.
Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | kernel/module.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c index a1951aba7a03..5184877ce98a 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -3212,6 +3212,17 @@ out: | |||
3212 | return err; | 3212 | return err; |
3213 | } | 3213 | } |
3214 | 3214 | ||
3215 | static int unknown_module_param_cb(char *param, char *val, const char *modname) | ||
3216 | { | ||
3217 | /* Check for magic 'dyndbg' arg */ | ||
3218 | int ret = ddebug_dyndbg_module_param_cb(param, val, modname); | ||
3219 | if (ret != 0) { | ||
3220 | printk(KERN_WARNING "%s: unknown parameter '%s' ignored\n", | ||
3221 | modname, param); | ||
3222 | } | ||
3223 | return 0; | ||
3224 | } | ||
3225 | |||
3215 | /* Allocate and load the module: note that size of section 0 is always | 3226 | /* Allocate and load the module: note that size of section 0 is always |
3216 | zero, and we rely on this for optional sections. */ | 3227 | zero, and we rely on this for optional sections. */ |
3217 | static int load_module(struct load_info *info, const char __user *uargs, | 3228 | static int load_module(struct load_info *info, const char __user *uargs, |
@@ -3298,7 +3309,7 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
3298 | 3309 | ||
3299 | /* Module is ready to execute: parsing args may do that. */ | 3310 | /* Module is ready to execute: parsing args may do that. */ |
3300 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, | 3311 | err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp, |
3301 | -32768, 32767, &ddebug_dyndbg_module_param_cb); | 3312 | -32768, 32767, unknown_module_param_cb); |
3302 | if (err < 0) | 3313 | if (err < 0) |
3303 | goto bug_cleanup; | 3314 | goto bug_cleanup; |
3304 | 3315 | ||