public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] module: Fix bug: read __param section as pointers to object
@ 2011-02-13 16:29 Imran Haider
  2011-02-13 23:09 ` Rusty Russell
  0 siblings, 1 reply; 2+ messages in thread
From: Imran Haider @ 2011-02-13 16:29 UTC (permalink / raw)
  To: rusty; +Cc: linux-kernel, Imran Haider

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(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index cb41837..5f843dc 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -292,7 +292,7 @@ struct module
 	unsigned int num_syms;
 
 	/* Kernel parameters. */
-	struct kernel_param *kp;
+	struct kernel_param **kpp;
 	unsigned int num_kp;
 
 	/* GPL-only exported symbols. */
diff --git a/kernel/module.c b/kernel/module.c
index efa290e..314b39d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -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;
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] module: Fix bug: read __param section as pointers to object
  2011-02-13 16:29 [PATCH] module: Fix bug: read __param section as pointers to object Imran Haider
@ 2011-02-13 23:09 ` Rusty Russell
  0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2011-02-13 23:09 UTC (permalink / raw)
  To: Imran Haider; +Cc: linux-kernel

On Mon, 14 Feb 2011 02:59:14 am Imran Haider wrote:
> 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.

This is linux-next?

Yes, completely broken.  I've removed the patch.

Thanks,
Rusty.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-14  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-13 16:29 [PATCH] module: Fix bug: read __param section as pointers to object Imran Haider
2011-02-13 23:09 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox