Skip to content

Commit ae82fdb

Browse files
committed
module_param: stop double-calling parameters.
Commit 026cee0 "params: <level>_initcall-like kernel parameters" set old-style module parameters to level 0. And we call those level 0 calls where we used to, early in start_kernel(). We also loop through the initcall levels and call the levelled module_params before the corresponding initcall. Unfortunately level 0 is early_init(), so we call the standard module_param calls twice. (Turns out most things don't care, but at least ubi.mtd does). Change the level to -1 for standard module_param calls. Reported-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: stable@kernel.org
1 parent f8f5701 commit ae82fdb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/linux/moduleparam.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct kparam_array
128128
* The ops can have NULL set or get functions.
129129
*/
130130
#define module_param_cb(name, ops, arg, perm) \
131-
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0)
131+
__module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1)
132132

133133
/**
134134
* <level>_param_cb - general callback for a module/cmdline parameter
@@ -192,7 +192,7 @@ struct kparam_array
192192
{ (void *)set, (void *)get }; \
193193
__module_param_call(MODULE_PARAM_PREFIX, \
194194
name, &__param_ops_##name, arg, \
195-
(perm) + sizeof(__check_old_set_param(set))*0, 0)
195+
(perm) + sizeof(__check_old_set_param(set))*0, -1)
196196

197197
/* We don't get oldget: it's often a new-style param_get_uint, etc. */
198198
static inline int
@@ -272,7 +272,7 @@ static inline void __kernel_param_unlock(void)
272272
*/
273273
#define core_param(name, var, type, perm) \
274274
param_check_##type(name, &(var)); \
275-
__module_param_call("", name, &param_ops_##type, &var, perm, 0)
275+
__module_param_call("", name, &param_ops_##type, &var, perm, -1)
276276
#endif /* !MODULE */
277277

278278
/**
@@ -290,7 +290,7 @@ static inline void __kernel_param_unlock(void)
290290
= { len, string }; \
291291
__module_param_call(MODULE_PARAM_PREFIX, name, \
292292
&param_ops_string, \
293-
.str = &__param_string_##name, perm, 0); \
293+
.str = &__param_string_##name, perm, -1); \
294294
__MODULE_PARM_TYPE(name, "string")
295295

296296
/**
@@ -432,7 +432,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp);
432432
__module_param_call(MODULE_PARAM_PREFIX, name, \
433433
&param_array_ops, \
434434
.arr = &__param_arr_##name, \
435-
perm, 0); \
435+
perm, -1); \
436436
__MODULE_PARM_TYPE(name, "array of " #type)
437437

438438
extern struct kernel_param_ops param_array_ops;

init/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ asmlinkage void __init start_kernel(void)
508508
parse_early_param();
509509
parse_args("Booting kernel", static_command_line, __start___param,
510510
__stop___param - __start___param,
511-
0, 0, &unknown_bootoption);
511+
-1, -1, &unknown_bootoption);
512512

513513
jump_label_init();
514514

0 commit comments

Comments
 (0)