diff options
author | Jessica Yu <jeyu@kernel.org> | 2018-06-29 16:37:08 +0200 |
---|---|---|
committer | Jessica Yu <jeyu@kernel.org> | 2018-07-02 11:36:17 +0200 |
commit | f314dfea16a085a58d2ff227ea9fa9e490ee5d18 (patch) | |
tree | c203005916d88e491f9cf333929ca9830a84277d /kernel/module_signing.c | |
parent | 996302c5e85650722f1e5aeaeaaac12f9f362bf8 (diff) | |
download | linux-f314dfea16a085a58d2ff227ea9fa9e490ee5d18.tar.gz linux-f314dfea16a085a58d2ff227ea9fa9e490ee5d18.tar.bz2 linux-f314dfea16a085a58d2ff227ea9fa9e490ee5d18.zip |
modsign: log module name in the event of an error
Now that we have the load_info struct all initialized (including
info->name, which contains the name of the module) before
module_sig_check(), make the load_info struct and hence module name
available to mod_verify_sig() so that we can log the module name in the
event of an error.
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Diffstat (limited to 'kernel/module_signing.c')
-rw-r--r-- | kernel/module_signing.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/module_signing.c b/kernel/module_signing.c index 937c844bee4a..f2075ce8e4b3 100644 --- a/kernel/module_signing.c +++ b/kernel/module_signing.c @@ -45,10 +45,10 @@ struct module_signature { /* * Verify the signature on a module. */ -int mod_verify_sig(const void *mod, unsigned long *_modlen) +int mod_verify_sig(const void *mod, struct load_info *info) { struct module_signature ms; - size_t modlen = *_modlen, sig_len; + size_t sig_len, modlen = info->len; pr_devel("==>%s(,%zu)\n", __func__, modlen); @@ -62,10 +62,11 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen) if (sig_len >= modlen) return -EBADMSG; modlen -= sig_len; - *_modlen = modlen; + info->len = modlen; if (ms.id_type != PKEY_ID_PKCS7) { - pr_err("Module is not signed with expected PKCS#7 message\n"); + pr_err("%s: Module is not signed with expected PKCS#7 message\n", + info->name); return -ENOPKG; } @@ -76,7 +77,8 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen) ms.__pad[0] != 0 || ms.__pad[1] != 0 || ms.__pad[2] != 0) { - pr_err("PKCS#7 signature info has unexpected non-zero params\n"); + pr_err("%s: PKCS#7 signature info has unexpected non-zero params\n", + info->name); return -EBADMSG; } |