Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e880168 authored by Dan Carpenter's avatar Dan Carpenter Committed by James Morris
Browse files

X.509: Fix error code in x509_cert_parse()



We forgot to set the error code on this path so it could result in
returning NULL which leads to a NULL dereference.

Fixes: db6c43bd ("crypto: KEYS: convert public key and digsig asym to the akcipher api")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
parent 381f20fc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen)
		}
	}

	ret = -ENOMEM;
	cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL);
	if (!cert->pub->key)
		goto error_decode;