aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-10-30 06:08:25 -0400
committerTakashi Iwai <tiwai@suse.de>2012-10-30 06:08:25 -0400
commita5d00dc3a4b65ed38249f3225e453944c633747b (patch)
tree6249ca5a5f13059f42890525a9ea7133778f3891 /kernel/module.c
parent1a8506d4402b6e96c2ed778dc7ccbb48d1e02fce (diff)
parent0914f7961babbf28aaa2f19b453951fb4841c03f (diff)
Merge branch 'for-linus' into for-next
... for migrating the core changes for USB-audio disconnection fixes
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c26
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
2423static int module_sig_check(struct load_info *info, 2423static 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) {