diff options
| author | Chen Ridong <chenridong@huawei.com> | 2024-11-04 12:17:45 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-12-05 14:01:20 +0100 |
| commit | bba9e38c5ad41d0a88b22a59e5b6dd3e31825118 (patch) | |
| tree | b0253e3129dd46f369497f21d89ebe38316e96b2 /drivers/crypto | |
| parent | 2eb0211de50c842eac4330b0ca9f6e1ae7d2f6f0 (diff) | |
| download | linux-bba9e38c5ad41d0a88b22a59e5b6dd3e31825118.tar.gz linux-bba9e38c5ad41d0a88b22a59e5b6dd3e31825118.tar.bz2 linux-bba9e38c5ad41d0a88b22a59e5b6dd3e31825118.zip | |
crypto: bcm - add error check in the ahash_hmac_init function
[ Upstream commit 19630cf57233e845b6ac57c9c969a4888925467b ]
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: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/crypto')
| -rw-r--r-- | drivers/crypto/bcm/cipher.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c index 1a3ecd44cbaf..20f6453670aa 100644 --- a/drivers/crypto/bcm/cipher.c +++ b/drivers/crypto/bcm/cipher.c @@ -2415,6 +2415,7 @@ static int ahash_hmac_setkey(struct crypto_ahash *ahash, const u8 *key, static int ahash_hmac_init(struct ahash_request *req) { + int ret; struct iproc_reqctx_s *rctx = ahash_request_ctx(req); struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct iproc_ctx_s *ctx = crypto_ahash_ctx(tfm); @@ -2424,7 +2425,9 @@ static int ahash_hmac_init(struct ahash_request *req) flow_log("ahash_hmac_init()\n"); /* init the context as a hash */ - ahash_init(req); + ret = ahash_init(req); + if (ret) + return ret; if (!spu_no_incr_hash(ctx)) { /* SPU-M can do incr hashing but needs sw for outer HMAC */ |
