summaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2010-08-05 20:59:07 +0200
committerRusty Russell <rusty@rustcorp.com.au>2010-08-05 05:29:07 +0200
commitd6df72a06e067139d491da4a9d14d92ad39e7a50 (patch)
tree2a7d0387df66c2d6f510cd9a24c622bf75ca669c /kernel/module.c
parentmodule: refactor out section header rewriting (diff)
downloadlinux-d6df72a06e067139d491da4a9d14d92ad39e7a50.tar.xz
linux-d6df72a06e067139d491da4a9d14d92ad39e7a50.zip
module: refactor out section header rewriting: FIX modversions
We can't do the find_sec after removing the SHF_ALLOC flags; it won't find the sections. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 91f3ebe230e3..ab07f67de996 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2225,11 +2225,13 @@ static int rewrite_section_headers(struct load_info *info)
if (strstarts(info->secstrings+shdr->sh_name, ".exit"))
shdr->sh_flags &= ~(unsigned long)SHF_ALLOC;
#endif
- /* Don't keep modinfo and version sections. */
- if (!strcmp(info->secstrings+shdr->sh_name, "__versions")
- || !strcmp(info->secstrings+shdr->sh_name, ".modinfo"))
- shdr->sh_flags &= ~(unsigned long)SHF_ALLOC;
}
+
+ /* Track but don't keep modinfo and version sections. */
+ info->index.vers = find_sec(info->hdr, info->sechdrs, info->secstrings, "__versions");
+ info->index.info = find_sec(info->hdr, info->sechdrs, info->secstrings, ".modinfo");
+ info->sechdrs[info->index.info].sh_flags &= ~(unsigned long)SHF_ALLOC;
+ info->sechdrs[info->index.vers].sh_flags &= ~(unsigned long)SHF_ALLOC;
return 0;
}
@@ -2282,8 +2284,6 @@ static struct module *setup_load_info(struct load_info *info)
return ERR_PTR(-ENOEXEC);
}
- info->index.vers = find_sec(info->hdr, info->sechdrs, info->secstrings, "__versions");
- info->index.info = find_sec(info->hdr, info->sechdrs, info->secstrings, ".modinfo");
info->index.pcpu = find_pcpusec(info->hdr, info->sechdrs, info->secstrings);
/* Check module struct version now, before we try to use module. */