]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
pkcs7: return correct error code if pkcs7_check_authattrs() fails
authorEric Biggers <ebiggers@google.com>
Fri, 8 Dec 2017 15:13:28 +0000 (15:13 +0000)
committerDavid Howells <dhowells@redhat.com>
Fri, 8 Dec 2017 15:13:28 +0000 (15:13 +0000)
If pkcs7_check_authattrs() returns an error code, we should pass that
error code on, rather than using ENOMEM.

Fixes: 99db44350672 ("PKCS#7: Appropriately restrict authenticated attributes and content type")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: James Morris <james.l.morris@oracle.com>
crypto/asymmetric_keys/pkcs7_parser.c

index c1ca1e86f5c4f86d1110343aa5194e2c3147f4d5..a6dcaa659aa8c162e2593df43c52259a0f2900c4 100644 (file)
@@ -148,8 +148,10 @@ struct pkcs7_message *pkcs7_parse_message(const void *data, size_t datalen)
        }
 
        ret = pkcs7_check_authattrs(ctx->msg);
-       if (ret < 0)
+       if (ret < 0) {
+               msg = ERR_PTR(ret);
                goto out;
+       }
 
        msg = ctx->msg;
        ctx->msg = NULL;