diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-16 22:27:58 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-16 22:27:58 -0500 |
| commit | d05f06e60df4f56a70fb8a3e46335b40687169e9 (patch) | |
| tree | c1eec6749fed86a21b08606e1e4acefe4b033253 /kernel/module.c | |
| parent | 0af1c5300db31f25a412e6e83d42b1747d56c9de (diff) | |
| parent | 1d72d9f83df057e71c7951def41138a0230bf737 (diff) | |
Merge branch 'arch-frv' into no-rebases
Diffstat (limited to 'kernel/module.c')
| -rw-r--r-- | kernel/module.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/kernel/module.c b/kernel/module.c index 0e2da8695f8e..6085f5ef88ea 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -2421,25 +2421,17 @@ static inline void kmemleak_load_module(const struct module *mod, | |||
| 2421 | 2421 | ||
| 2422 | #ifdef CONFIG_MODULE_SIG | 2422 | #ifdef CONFIG_MODULE_SIG |
| 2423 | static int module_sig_check(struct load_info *info, | 2423 | static int module_sig_check(struct load_info *info, |
| 2424 | const void *mod, unsigned long *len) | 2424 | const void *mod, unsigned long *_len) |
| 2425 | { | 2425 | { |
| 2426 | int err = -ENOKEY; | 2426 | int err = -ENOKEY; |
| 2427 | const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1; | 2427 | unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1; |
| 2428 | const void *p = mod, *end = mod + *len; | 2428 | unsigned long len = *_len; |
| 2429 | 2429 | ||
| 2430 | /* Poor man's memmem. */ | 2430 | if (len > markerlen && |
| 2431 | while ((p = memchr(p, MODULE_SIG_STRING[0], end - p))) { | 2431 | memcmp(mod + len - markerlen, MODULE_SIG_STRING, markerlen) == 0) { |
| 2432 | if (p + markerlen > end) | 2432 | /* We truncate the module to discard the signature */ |
| 2433 | break; | 2433 | *_len -= markerlen; |
| 2434 | 2434 | err = mod_verify_sig(mod, _len); | |
| 2435 | if (memcmp(p, MODULE_SIG_STRING, markerlen) == 0) { | ||
| 2436 | const void *sig = p + markerlen; | ||
| 2437 | /* Truncate module up to signature. */ | ||
| 2438 | *len = p - mod; | ||
| 2439 | err = mod_verify_sig(mod, *len, sig, end - sig); | ||
| 2440 | break; | ||
| 2441 | } | ||
| 2442 | p++; | ||
| 2443 | } | 2435 | } |
| 2444 | 2436 | ||
| 2445 | if (!err) { | 2437 | if (!err) { |
