Commit a5dd69707424a35d2d2cc094e870f595ad61e916
Committed by
Linus Torvalds
1 parent
6c2545eeff
Exists in
master
and in
20 other branches
module: be more picky about allowing missing module versions
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>
Showing 1 changed file with 7 additions and 2 deletions Side-by-side Diff
kernel/module.c
... | ... | @@ -917,6 +917,10 @@ |
917 | 917 | if (!crc) |
918 | 918 | return 1; |
919 | 919 | |
920 | + /* No versions at all? modprobe --force does this. */ | |
921 | + if (versindex == 0) | |
922 | + return try_to_force_load(mod, symname) == 0; | |
923 | + | |
920 | 924 | versions = (void *) sechdrs[versindex].sh_addr; |
921 | 925 | num_versions = sechdrs[versindex].sh_size |
922 | 926 | / sizeof(struct modversion_info); |
... | ... | @@ -932,8 +936,9 @@ |
932 | 936 | goto bad_version; |
933 | 937 | } |
934 | 938 | |
935 | - if (!try_to_force_load(mod, symname)) | |
936 | - return 1; | |
939 | + printk(KERN_WARNING "%s: no symbol version for %s\n", | |
940 | + mod->name, symname); | |
941 | + return 0; | |
937 | 942 | |
938 | 943 | bad_version: |
939 | 944 | printk("%s: disagrees about version of symbol %s\n", |