public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Imran Haider <imran1008@gmail.com>
To: rusty@rustcorp.com.au
Cc: linux-kernel@vger.kernel.org, Imran Haider <imran1008@gmail.com>
Subject: [PATCH] module: Fix bug: read __param section as pointers to object
Date: Sun, 13 Feb 2011 11:29:14 -0500	[thread overview]
Message-ID: <1297614554-24373-1-git-send-email-imran1008@gmail.com> (raw)

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


             reply	other threads:[~2011-02-13 16:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13 16:29 Imran Haider [this message]
2011-02-13 23:09 ` [PATCH] module: Fix bug: read __param section as pointers to object Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297614554-24373-1-git-send-email-imran1008@gmail.com \
    --to=imran1008@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox