blob: bced160619c1be2ae1b3eed3640bf019c534a309 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
--- a/kernel/module-verify.c
+++ a/kernel/module-verify.c
@@ -391,16 +391,19 @@ static int extract_elf_rel(struct module_verify_data *mvdata,
#endif
} __packed relocation;
+ const Elf_Shdr *relsec, *symsec, *strsec;
const Elf_Rel *reloc;
const Elf_Sym *symbols, *symbol;
const char *strings;
unsigned long r_sym;
size_t nsyms, loop;
- nsyms = mvdata->sections[secix].sh_size / sizeof(Elf_Sym);
- symbols = mvdata->buffer + mvdata->sections[secix].sh_offset;
- strings = mvdata->buffer +
- mvdata->sections[mvdata->sections[secix].sh_link].sh_offset;
+ relsec = &mvdata->sections[secix];
+ symsec = &mvdata->sections[relsec->sh_link];
+ strsec = &mvdata->sections[symsec->sh_link];
+ nsyms = symsec->sh_size / sizeof(Elf_Sym);
+ symbols = mvdata->buffer + symsec->sh_offset;
+ strings = mvdata->buffer + strsec->sh_offset;
/* Contribute the relevant bits from a join of
* { REL, SYMBOL, SECTION }
|