[PATCH 18/46] kbuild: fix segfault in modpost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do not try to look up section name until we know it is not a special
section. Otherwise we will address outside legal space and segfault.

Signed-off-by: Sam Ravnborg <[email protected]>

---

 scripts/mod/modpost.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

8ea80ca4f583e377c902811d42626ccfce16913f
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index a7360c3..eeaf574 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -576,11 +576,11 @@ static void check_sec_ref(struct module 
 			r.r_offset = TO_NATIVE(rela->r_offset);
 			r.r_info   = TO_NATIVE(rela->r_info);
 			sym = elf->symtab_start + ELF_R_SYM(r.r_info);
-			secname = secstrings + sechdrs[sym->st_shndx].sh_name;
 			/* Skip special sections */
 			if (sym->st_shndx >= SHN_LORESERVE)
 				continue;
 
+			secname = secstrings + sechdrs[sym->st_shndx].sh_name;
 			if (section(secname))
 				warn_sec_mismatch(modname, name, elf, sym, r);
 		}
-- 
1.0.GIT


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux