Skip to content

Commit

Permalink
module: be more picky about allowing missing module versions
Browse files Browse the repository at this point in the history
We allow missing __versions sections, because modprobe --force strips
it.  It makes less sense to allow sections where there's no version
for a specific symbol the module uses, so disallow that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
rustyrussell authored and torvalds committed May 9, 2008
1 parent 6c2545e commit a5dd697
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,10 @@ static int check_version(Elf_Shdr *sechdrs,
if (!crc)
return 1;

/* No versions at all? modprobe --force does this. */
if (versindex == 0)
return try_to_force_load(mod, symname) == 0;

versions = (void *) sechdrs[versindex].sh_addr;
num_versions = sechdrs[versindex].sh_size
/ sizeof(struct modversion_info);
Expand All @@ -932,8 +936,9 @@ static int check_version(Elf_Shdr *sechdrs,
goto bad_version;
}

if (!try_to_force_load(mod, symname))
return 1;
printk(KERN_WARNING "%s: no symbol version for %s\n",
mod->name, symname);
return 0;

bad_version:
printk("%s: disagrees about version of symbol %s\n",
Expand Down

0 comments on commit a5dd697

Please sign in to comment.