linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] crypto: chelsio - check set_msg_len overflow in generate_b0
@ 2018-12-28  6:41 YueHaibing
  2019-01-11  6:31 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-12-28  6:41 UTC (permalink / raw)
  To: harsh, herbert, davem; +Cc: linux-kernel, linux-crypto, YueHaibing

set_msg_len may fails with -EOVERFLOW, It should be propagate
to upstream.

Fixes: 2debd3325e55 ("crypto: chcr - Add AEAD algos.")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/crypto/chelsio/chcr_algo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index bcef765..bdbdce9 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -2762,7 +2762,7 @@ static int set_msg_len(u8 *block, unsigned int msglen, int csize)
 	return 0;
 }
 
-static void generate_b0(struct aead_request *req, u8 *ivptr,
+static int generate_b0(struct aead_request *req, u8 *ivptr,
 			unsigned short op_type)
 {
 	unsigned int l, lp, m;
@@ -2787,6 +2787,8 @@ static void generate_b0(struct aead_request *req, u8 *ivptr,
 	rc = set_msg_len(b0 + 16 - l,
 			 (op_type == CHCR_DECRYPT_OP) ?
 			 req->cryptlen - m : req->cryptlen, l);
+
+	return rc;
 }
 
 static inline int crypto_ccm_check_iv(const u8 *iv)
@@ -2821,7 +2823,7 @@ static int ccm_format_packet(struct aead_request *req,
 		*((unsigned short *)(reqctx->scratch_pad + 16)) =
 				htons(assoclen);
 
-	generate_b0(req, ivptr, op_type);
+	rc = generate_b0(req, ivptr, op_type);
 	/* zero the ctr value */
 	memset(ivptr + 15 - ivptr[0], 0, ivptr[0] + 1);
 	return rc;
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] crypto: chelsio - check set_msg_len overflow in generate_b0
  2018-12-28  6:41 [PATCH -next] crypto: chelsio - check set_msg_len overflow in generate_b0 YueHaibing
@ 2019-01-11  6:31 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-01-11  6:31 UTC (permalink / raw)
  To: YueHaibing; +Cc: harsh, davem, linux-kernel, linux-crypto

On Fri, Dec 28, 2018 at 02:41:00PM +0800, YueHaibing wrote:
> set_msg_len may fails with -EOVERFLOW, It should be propagate
> to upstream.
> 
> Fixes: 2debd3325e55 ("crypto: chcr - Add AEAD algos.")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/crypto/chelsio/chcr_algo.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-11  6:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28  6:41 [PATCH -next] crypto: chelsio - check set_msg_len overflow in generate_b0 YueHaibing
2019-01-11  6:31 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).