Skip to content

Commit 8ea80ca

Browse files
author
Sam Ravnborg
committed
kbuild: fix segfault in modpost
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]>
1 parent 41370d3 commit 8ea80ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/mod/modpost.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,11 +576,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
576576
r.r_offset = TO_NATIVE(rela->r_offset);
577577
r.r_info = TO_NATIVE(rela->r_info);
578578
sym = elf->symtab_start + ELF_R_SYM(r.r_info);
579-
secname = secstrings + sechdrs[sym->st_shndx].sh_name;
580579
/* Skip special sections */
581580
if (sym->st_shndx >= SHN_LORESERVE)
582581
continue;
583582

583+
secname = secstrings + sechdrs[sym->st_shndx].sh_name;
584584
if (section(secname))
585585
warn_sec_mismatch(modname, name, elf, sym, r);
586586
}

0 commit comments

Comments
 (0)