summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2004-08-30 20:36:51 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-08-30 20:36:51 -0700
commit758638eb8ed5feb31636e83ab6a4ebd0024a2721 (patch)
treee3d44df5f13796de2634c295f4fb818b77848bfa /kernel
parent8cc423214cd76091611f167b3f2695295b814186 (diff)
[PATCH] Don't OOPS on stripped modules
Don't want to go overboard with the checks, but this is simple and reasonable. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (modified) Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/module.c b/kernel/module.c
index aa91a98ffb0b..8c17a4ce0707 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1538,9 +1538,6 @@ static struct module *load_module(void __user *umod,
secstrings = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
sechdrs[0].sh_addr = 0;
- /* And these should exist, but gcc whinges if we don't init them */
- symindex = strindex = 0;
-
for (i = 1; i < hdr->e_shnum; i++) {
if (sechdrs[i].sh_type != SHT_NOBITS
&& len < sechdrs[i].sh_offset + sechdrs[i].sh_size)
@@ -1572,6 +1569,13 @@ static struct module *load_module(void __user *umod,
}
mod = (void *)sechdrs[modindex].sh_addr;
+ if (symindex == 0) {
+ printk(KERN_WARNING "%s: module has no symbols (stripped?)\n",
+ mod->name);
+ err = -ENOEXEC;
+ goto free_hdr;
+ }
+
/* Optional sections */
exportindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab");
gplindex = find_sec(hdr, sechdrs, secstrings, "__ksymtab_gpl");