summaryrefslogtreecommitdiff
path: root/kernel/module.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.osdl.org>2004-01-07 05:47:04 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2004-01-07 05:47:04 -0800
commit1a6100caae4257b3992e1e747340bf49de1e8c38 (patch)
tree4d54259e9fa7542792dbec59e2d68f0c469825f8 /kernel/module.c
parente32c91c0019ec6e2a706de712ed16b9d96f4e203 (diff)
Don't relocate non-allocated regions in modules.
This fixes loading of modules compiled with debugging on some platforms. From Rusty.
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 2997c3e89974..65f82a3278dd 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1618,6 +1618,16 @@ static struct module *load_module(void __user *umod,
/* Now do relocations. */
for (i = 1; i < hdr->e_shnum; i++) {
const char *strtab = (char *)sechdrs[strindex].sh_addr;
+ unsigned int info = sechdrs[i].sh_info;
+
+ /* Not a valid relocation section? */
+ if (info >= hdr->e_shnum)
+ continue;
+
+ /* Don't bother with non-allocated sections */
+ if (!(sechdrs[info].sh_flags & SHF_ALLOC))
+ continue;
+
if (sechdrs[i].sh_type == SHT_REL)
err = apply_relocate(sechdrs, strtab, symindex, i,mod);
else if (sechdrs[i].sh_type == SHT_RELA)