diff mbox

crypto: drbg - fix an error code in drbg_init_sym_kernel()

Message ID 20160617091618.GC25609@mwanda (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Dan Carpenter June 17, 2016, 9:16 a.m. UTC
We accidentally return PTR_ERR(NULL) which is success but we should
return -ENOMEM.

Fixes: 355912852115 ('crypto: drbg - use CTR AES instead of ECB AES')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Stephan Mueller June 17, 2016, 9:19 a.m. UTC | #1
Am Freitag, 17. Juni 2016, 12:16:19 schrieb Dan Carpenter:

Hi Dan,

> We accidentally return PTR_ERR(NULL) which is success but we should
> return -ENOMEM.
> 
> Fixes: 355912852115 ('crypto: drbg - use CTR AES instead of ECB AES')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Stephan Mueller <smueller@chronox.de>

That points to an error in the documentation of skcipher_request_alloc.

I will send a follow-up patch.
> 
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index ded8638..6872d15 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1686,7 +1686,7 @@ static int drbg_init_sym_kernel(struct drbg_state
> *drbg) if (!req) {
>  		pr_info("DRBG: could not allocate request queue\n");
>  		drbg_fini_sym_kernel(drbg);
> -		return PTR_ERR(req);
> +		return -ENOMEM;
>  	}
>  	drbg->ctr_req = req;
>  	skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,


Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephan Mueller June 17, 2016, 9:23 a.m. UTC | #2
Am Freitag, 17. Juni 2016, 11:19:58 schrieb Stephan Mueller:

Hi Stephan,

> Am Freitag, 17. Juni 2016, 12:16:19 schrieb Dan Carpenter:
> 
> Hi Dan,
> 
> > We accidentally return PTR_ERR(NULL) which is success but we should
> > return -ENOMEM.
> > 
> > Fixes: 355912852115 ('crypto: drbg - use CTR AES instead of ECB AES')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Acked-by: Stephan Mueller <smueller@chronox.de>
> 
> That points to an error in the documentation of skcipher_request_alloc.

Apologies, that documentation issue has already been fixed in the 
cryptodev-2.6 tree. I was looking at the vanilla 4.6 tree for the 
documentation while I was preparing my patch.

Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu June 20, 2016, 11:35 a.m. UTC | #3
On Fri, Jun 17, 2016 at 12:16:19PM +0300, Dan Carpenter wrote:
> We accidentally return PTR_ERR(NULL) which is success but we should
> return -ENOMEM.
> 
> Fixes: 355912852115 ('crypto: drbg - use CTR AES instead of ECB AES')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Patch applied.  Thanks.
diff mbox

Patch

diff --git a/crypto/drbg.c b/crypto/drbg.c
index ded8638..6872d15 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1686,7 +1686,7 @@  static int drbg_init_sym_kernel(struct drbg_state *drbg)
 	if (!req) {
 		pr_info("DRBG: could not allocate request queue\n");
 		drbg_fini_sym_kernel(drbg);
-		return PTR_ERR(req);
+		return -ENOMEM;
 	}
 	drbg->ctr_req = req;
 	skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,