Signed-off-by: Dmitry Kasatkin <[email protected]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to