Skip to content

Commit 1b364bf

Browse files
James Bottomleytorvalds
authored andcommitted
module: workaround duplicate section names
The root cause is a duplicate section name (.text); is this legal? [ Amerigo Wang: "AFAIK, yes." ] However, there's a problem with commit 6d76013 in that if you fail to allocate a mod->sect_attrs (in this case it's null because of the duplication), it still gets used without checking in add_notes_attrs() This should fix it [ This patch leaves other problems, particularly the sections directory, but recent parisc toolchains seem to produce these modules and this prevents a crash and is a minimal change -- RR ] Signed-off-by: James Bottomley <[email protected]> Signed-off-by: Rusty Russell <[email protected]> Tested-by: Helge Deller <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 7d1d16e commit 1b364bf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/module.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2355,7 +2355,8 @@ static noinline struct module *load_module(void __user *umod,
23552355
if (err < 0)
23562356
goto unlink;
23572357
add_sect_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
2358-
add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
2358+
if (mod->sect_attrs)
2359+
add_notes_attrs(mod, hdr->e_shnum, secstrings, sechdrs);
23592360

23602361
/* Get rid of temporary copy */
23612362
vfree(hdr);

0 commit comments

Comments
 (0)