module: Fix bug: read __param section as pointers to object
PATCH 1/1 module: Fix bug: read __param section as pointers to object
Recent changes in commit 3834583b causes module parameters to be stored in the __param section as pointer to struct instead of the struct itself. module.c was still reading the section as an array of struct which caused modules to not load when any module parameter is specified.
--- include/linux/module.h | 2 +- kernel/module.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/module.h +1 -1
@@ -292,7 +292,7 @@ struct moduleunsigned int num_syms;/* Kernel parameters. */ -struct kernel_param *kp; +struct kernel_param **kpp;unsigned int num_kp;/* GPL-only exported symbols. */
kernel/module.c +5 -5
@@ -1693,7 +1693,7 @@ static void free_module(struct module *mod)module_unload_free (mod);/* Free any allocated parameters. */ -destroy_params (mod->kp, mod->num_kp); +destroy_params (*mod->kpp, mod->num_kp);/* This may be NULL, but that's OK */ unset_section_ro_nx (mod, mod->module_init);
@@ -2429,8 +2429,8 @@ static int check_modinfo(struct module *mod, struct load_info *info)static void find_module_sections (struct module *mod,struct load_info *info) { - mod->kp =section_objs (info,"__param" , -sizeof (*mod->kp), &mod->num_kp); + mod->kpp =section_objs (info,"__param" , +sizeof (void *), &mod->num_kp); mod->syms =section_objs (info,"__ksymtab" ,sizeof (*mod->syms), &mod->num_syms); mod->crcs =section_addr (info,"__kcrctab" );
@@ -2803,12 +2803,12 @@ static struct module *load_module(void __user *umod,mutex_unlock (&module_mutex);/* Module is ready to execute: parsing args may do that. */ - err =parse_args (mod->name, mod->args, mod->kp, mod->num_kp,NULL ); + err =parse_args (mod->name, mod->args, *(mod->kpp), mod->num_kp,NULL );if (err <0 ) goto unlink;/* Link in to syfs. */ - err =mod_sysfs_setup (mod, &info, mod->kp, mod->num_kp); + err =mod_sysfs_setup (mod, &info, *(mod->kpp), mod->num_kp);if (err <0 ) goto unlink;
Signature · 1 line
1.7.3.4
Quoted 4 lines · Imran Haider
Recent changes in commit
3834583bcauses module parameters to be stored in the__paramsection as pointer to struct instead of the struct itself.module.cwas still reading the section as an array of struct which caused modules to not load when any module parameter is specified.
This is linux-next?
Yes, completely broken. I've removed the patch.
Thanks,
Rusty.