Message ID | 20170209155724.19737-1-weiyj.lk@gmail.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show |
Wei Yongjun <weiyj.lk@gmail.com> wrote: > --- a/crypto/asymmetric_keys/public_key.c > +++ b/crypto/asymmetric_keys/public_key.c > @@ -184,8 +184,10 @@ static int software_key_eds_op(struct kernel_pkey_params *params, > return PTR_ERR(tfm); > > req = akcipher_request_alloc(tfm, GFP_KERNEL); > - if (!req) > + if (!req) { > + ret = -ENOMEM; Ummm... What should I apply your patch to? > goto error_free_tfm; > + } > > if (pkey->key_is_private) > ret = crypto_akcipher_set_priv_key(tfm, > @@ -268,8 +270,10 @@ int public_key_verify_signature(const struct public_key *pkey, > return PTR_ERR(tfm); > > req = akcipher_request_alloc(tfm, GFP_KERNEL); > - if (!req) > + if (!req) { > + ret = -ENOMEM; > goto error_free_tfm; This shouldn't be necessary. ret should already be -ENOMEM from initialisation of the variable at the top of the function. David
Hi David, > > --- a/crypto/asymmetric_keys/public_key.c > > +++ b/crypto/asymmetric_keys/public_key.c > > @@ -184,8 +184,10 @@ static int software_key_eds_op(struct > kernel_pkey_params *params, > > return PTR_ERR(tfm); > > > > req = akcipher_request_alloc(tfm, GFP_KERNEL); > > - if (!req) > > + if (!req) { > > + ret = -ENOMEM; > > Ummm... What should I apply your patch to? This one introduced by patch " KEYS: Implement encrypt, decrypt and sign for software asymmetric key". > > > goto error_free_tfm; > > + } > > > > if (pkey->key_is_private) > > ret = crypto_akcipher_set_priv_key(tfm, > > @@ -268,8 +270,10 @@ int public_key_verify_signature(const struct > public_key *pkey, > > return PTR_ERR(tfm); > > > > req = akcipher_request_alloc(tfm, GFP_KERNEL); > > - if (!req) > > + if (!req) { > > + ret = -ENOMEM; > > goto error_free_tfm; > > This shouldn't be necessary. ret should already be -ENOMEM from > initialisation of the variable at the top of the function. Introduced by patch " KEYS: Provide software public key query function", ret have been overwritten to 0 after ret = software_key_determine_akcipher(...). Regards, Wei Yongjun
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c index 3a23274..3131bba 100644 --- a/crypto/asymmetric_keys/public_key.c +++ b/crypto/asymmetric_keys/public_key.c @@ -184,8 +184,10 @@ static int software_key_eds_op(struct kernel_pkey_params *params, return PTR_ERR(tfm); req = akcipher_request_alloc(tfm, GFP_KERNEL); - if (!req) + if (!req) { + ret = -ENOMEM; goto error_free_tfm; + } if (pkey->key_is_private) ret = crypto_akcipher_set_priv_key(tfm, @@ -268,8 +270,10 @@ int public_key_verify_signature(const struct public_key *pkey, return PTR_ERR(tfm); req = akcipher_request_alloc(tfm, GFP_KERNEL); - if (!req) + if (!req) { + ret = -ENOMEM; goto error_free_tfm; + } if (pkey->key_is_private) ret = crypto_akcipher_set_priv_key(tfm,