Skip to contentSkip to conversation

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

PATCH In review Dan Carpenter 3 participants 4 messages Jun 17, 2016 – Jun 20, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

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')
crypto/drbg.c +1 -1
index ded8638..6872d15 100644
@@ -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,
Acked-by on v1 1/1
#1 lore raw

Am Freitag, 17. Juni 2016, 12:16:19 schrieb Dan Carpenter:

Hi Dan,

Quoted 5 lines

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')

That points to an error in the documentation of skcipher_request_alloc.

I will send a follow-up patch.

Quoted 6 lines
crypto/drbg.c +0 -0
index ded8638..6872d15 100644

crypto/drbg.c static int drbg_init_sym_kernel(struct drbg_state · line 1692

Quoted 8 lines
crypto/drbg.c +1 -1
@@ -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

#2 lore raw

Am Freitag, 17. Juni 2016, 11:19:58 schrieb Stephan Mueller:

Hi Stephan,

Quoted 7 lines

Am Freitag, 17. Juni 2016, 12:16:19 schrieb Dan Carpenter:

Hi Dan,

Quoted 3 lines

We accidentally return PTR_ERR(NULL) which is success but we should return -ENOMEM.

Quoted 6 lines
Quoted 2 lines
Fixes 355912852115 ('crypto: drbg - use CTR AES instead of ECB AES')

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

maintainer
#3 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

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')

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt