[PATCH 2/4] KEYS: fix couple of things

Dmitry Kasatkin
2014-06-10T08:49:41Z

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
---
crypto/asymmetric_keys/x509_public_key.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c
index 6af338f..962f9b9 100644
--- a/crypto/asymmetric_keys/x509_public_key.c
+++ b/crypto/asymmetric_keys/x509_public_key.c
@@ -177,6 +177,7 @@ static int x509_validate_trust(struct x509_certificate *cert,
if (!IS_ERR(key)) {
pk = key->payload.data;
ret = x509_check_signature(pk, cert);
+ key_put(key);
}
return ret;
}
@@ -237,7 +238,7 @@ static int x509_key_preparse(struct key_preparsed_payload *prep)
ret = x509_check_signature(cert->pub, cert); /* self-signed */
if (ret < 0)
goto error_free_cert;
- } else {
+ } else if (!prep->trusted) {
ret = x509_validate_trust(cert,
get_system_or_owner_trusted_keyring());
if (!ret)
--
1.9.1