diff options
author | Patrick Wildt | 2020-05-07 02:17:14 +0200 |
---|---|---|
committer | Heinrich Schuchardt | 2020-05-07 18:23:17 +0200 |
commit | 6f146155f879ff42d465f0cca8ec2a7f8cb0961e (patch) | |
tree | 5d85feacbdbb146ba4d34c4d330b6dbe4401d2cc /lib/efi_loader/efi_image_loader.c | |
parent | 9ad15227bb92acc2bf73c60da1bcf2ae3774246d (diff) |
efi_loader: pkcs7_parse_message() returns error pointer
Since pkcs7_parse_message() returns an error pointer, we must not
check for NULL. We have to explicitly set msg to NULL in the error
case, otherwise the call to pkcs7_free_message() on the goto err
path will assume it's a valid object.
Signed-off-by: Patrick Wildt <patrick@blueri.se>
Add missing include linux/err.h
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/efi_loader/efi_image_loader.c')
-rw-r--r-- | lib/efi_loader/efi_image_loader.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index 5a9a6424cc1..ac4f65c9d82 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -14,6 +14,7 @@ #include <pe.h> #include <sort.h> #include "crypto/pkcs7_parser.h" +#include <linux/err.h> const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID; const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID; @@ -538,8 +539,9 @@ static bool efi_image_authenticate(void *efi, size_t efi_size) } msg = pkcs7_parse_message((void *)wincert + sizeof(*wincert), wincert->dwLength - sizeof(*wincert)); - if (!msg) { + if (IS_ERR(msg)) { debug("Parsing image's signature failed\n"); + msg = NULL; goto err; } |