Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 54041d8a authored by Rusty Russell's avatar Rusty Russell
Browse files

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: default avatarAndy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 86f12003
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -3212,6 +3212,17 @@ static int complete_formation(struct module *mod, struct load_info *info)
	return err;
	return err;
}
}


static int unknown_module_param_cb(char *param, char *val, const char *modname)
{
	/* Check for magic 'dyndbg' arg */ 
	int ret = ddebug_dyndbg_module_param_cb(param, val, modname);
	if (ret != 0) {
		printk(KERN_WARNING "%s: unknown parameter '%s' ignored\n",
		       modname, param);
	}
	return 0;
}

/* Allocate and load the module: note that size of section 0 is always
/* Allocate and load the module: note that size of section 0 is always
   zero, and we rely on this for optional sections. */
   zero, and we rely on this for optional sections. */
static int load_module(struct load_info *info, const char __user *uargs,
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,


	/* Module is ready to execute: parsing args may do that. */
	/* Module is ready to execute: parsing args may do that. */
	err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
	err = parse_args(mod->name, mod->args, mod->kp, mod->num_kp,
			 -32768, 32767, &ddebug_dyndbg_module_param_cb);
			 -32768, 32767, unknown_module_param_cb);
	if (err < 0)
	if (err < 0)
		goto bug_cleanup;
		goto bug_cleanup;