diff options
author | Ovidiu Panait <ovidiu.panait@windriver.com> | 2023-12-24 10:21:34 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-25 14:33:33 -0800 |
commit | 4532bf0aaedae56a9a0313f6a8e19f1536a076ae (patch) | |
tree | c154a8f6548d91f3347b1f3990636049321300e0 /drivers/crypto | |
parent | 882eba76746aa86d3295112fbb140829bd1145db (diff) | |
download | linux-stable-4532bf0aaedae56a9a0313f6a8e19f1536a076ae.tar.gz linux-stable-4532bf0aaedae56a9a0313f6a8e19f1536a076ae.tar.bz2 linux-stable-4532bf0aaedae56a9a0313f6a8e19f1536a076ae.zip |
crypto: sahara - improve error handling in sahara_sha_process()
[ Upstream commit 5deff027fca49a1eb3b20359333cf2ae562a2343 ]
sahara_sha_hw_data_descriptor_create() returns negative error codes on
failure, so make sure the errors are correctly handled / propagated.
Fixes: 5a2bb93f5992 ("crypto: sahara - add support for SHA1/256")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.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/sahara.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c index 96cb77abbabb..c69016faff6f 100644 --- a/drivers/crypto/sahara.c +++ b/drivers/crypto/sahara.c @@ -1007,7 +1007,10 @@ static int sahara_sha_process(struct ahash_request *req) return ret; if (rctx->first) { - sahara_sha_hw_data_descriptor_create(dev, rctx, req, 0); + ret = sahara_sha_hw_data_descriptor_create(dev, rctx, req, 0); + if (ret) + return ret; + dev->hw_desc[0]->next = 0; rctx->first = 0; } else { @@ -1015,7 +1018,10 @@ static int sahara_sha_process(struct ahash_request *req) sahara_sha_hw_context_descriptor_create(dev, rctx, req, 0); dev->hw_desc[0]->next = dev->hw_phys_desc[1]; - sahara_sha_hw_data_descriptor_create(dev, rctx, req, 1); + ret = sahara_sha_hw_data_descriptor_create(dev, rctx, req, 1); + if (ret) + return ret; + dev->hw_desc[1]->next = 0; } |