Skip to content

Commit 19630cf

Browse files
Chen Ridongherbertx
authored andcommitted
crypto: bcm - add error check in the ahash_hmac_init function
The ahash_init functions may return fails. The ahash_hmac_init should not return ok when ahash_init returns error. For an example, ahash_init will return -ENOMEM when allocation memory is error. Fixes: 9d12ba8 ("crypto: brcm - Add Broadcom SPU driver") Signed-off-by: Chen Ridong <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent b64140c commit 19630cf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/crypto/bcm/cipher.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,6 +2415,7 @@ static int ahash_hmac_setkey(struct crypto_ahash *ahash, const u8 *key,
24152415

24162416
static int ahash_hmac_init(struct ahash_request *req)
24172417
{
2418+
int ret;
24182419
struct iproc_reqctx_s *rctx = ahash_request_ctx(req);
24192420
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
24202421
struct iproc_ctx_s *ctx = crypto_ahash_ctx(tfm);
@@ -2424,7 +2425,9 @@ static int ahash_hmac_init(struct ahash_request *req)
24242425
flow_log("ahash_hmac_init()\n");
24252426

24262427
/* init the context as a hash */
2427-
ahash_init(req);
2428+
ret = ahash_init(req);
2429+
if (ret)
2430+
return ret;
24282431

24292432
if (!spu_no_incr_hash(ctx)) {
24302433
/* SPU-M can do incr hashing but needs sw for outer HMAC */

0 commit comments

Comments
 (0)