From: Ben Hutchings Date: Sun, 5 May 2019 12:45:06 +0000 (+0100) Subject: MODSIGN: Make shash allocation failure fatal X-Git-Tag: archive/raspbian/5.2.17-1+rpi1^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=70a807a42f2c03693344a9ea7a3eceb427502501;p=linux.git MODSIGN: Make shash allocation failure fatal mod_is_hash_blacklisted() currently returns 0 (suceess) if crypto_alloc_shash() fails. This should instead be a fatal error, so unwrap and pass up the error code. Signed-off-by: Ben Hutchings Gbp-Pq: Topic features/all/db-mok-keyring Gbp-Pq: Name modsign-make-shash-allocation-failure-fatal.patch --- diff --git a/kernel/module_signing.c b/kernel/module_signing.c index ee3a87fb2e7..3afff3718d7 100644 --- a/kernel/module_signing.c +++ b/kernel/module_signing.c @@ -47,11 +47,13 @@ static int mod_is_hash_blacklisted(const void *mod, size_t verifylen) struct shash_desc *desc; size_t digest_size, desc_size; u8 *digest; - int ret = 0; + int ret; tfm = crypto_alloc_shash("sha256", 0, 0); - if (IS_ERR(tfm)) + if (IS_ERR(tfm)) { + ret = PTR_ERR(tfm); goto error_return; + } desc_size = crypto_shash_descsize(tfm) + sizeof(*desc); digest_size = crypto_shash_digestsize(tfm);