crypto: marvell/cesa - Fix engine load inaccuracy
[ Upstream commit 442134ab30e75b7229c4bfc1ac5641d245cffe27 ]
If an error occurs during queueing the engine load will never be
decremented. Fix this by moving the engine load adjustment into
the cleanup function.
Fixes: bf8f91e711 ("crypto: marvell - Add load balancing between engines")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
13db02bb8e
commit
fbcac128fe
@@ -75,9 +75,12 @@ mv_cesa_skcipher_dma_cleanup(struct skcipher_request *req)
|
||||
static inline void mv_cesa_skcipher_cleanup(struct skcipher_request *req)
|
||||
{
|
||||
struct mv_cesa_skcipher_req *creq = skcipher_request_ctx(req);
|
||||
struct mv_cesa_engine *engine = creq->base.engine;
|
||||
|
||||
if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ)
|
||||
mv_cesa_skcipher_dma_cleanup(req);
|
||||
|
||||
atomic_sub(req->cryptlen, &engine->load);
|
||||
}
|
||||
|
||||
static void mv_cesa_skcipher_std_step(struct skcipher_request *req)
|
||||
@@ -205,7 +208,6 @@ mv_cesa_skcipher_complete(struct crypto_async_request *req)
|
||||
struct mv_cesa_engine *engine = creq->base.engine;
|
||||
unsigned int ivsize;
|
||||
|
||||
atomic_sub(skreq->cryptlen, &engine->load);
|
||||
ivsize = crypto_skcipher_ivsize(crypto_skcipher_reqtfm(skreq));
|
||||
|
||||
if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ) {
|
||||
|
||||
@@ -109,9 +109,12 @@ static inline void mv_cesa_ahash_dma_cleanup(struct ahash_request *req)
|
||||
static inline void mv_cesa_ahash_cleanup(struct ahash_request *req)
|
||||
{
|
||||
struct mv_cesa_ahash_req *creq = ahash_request_ctx(req);
|
||||
struct mv_cesa_engine *engine = creq->base.engine;
|
||||
|
||||
if (mv_cesa_req_get_type(&creq->base) == CESA_DMA_REQ)
|
||||
mv_cesa_ahash_dma_cleanup(req);
|
||||
|
||||
atomic_sub(req->nbytes, &engine->load);
|
||||
}
|
||||
|
||||
static void mv_cesa_ahash_last_cleanup(struct ahash_request *req)
|
||||
@@ -371,8 +374,6 @@ static void mv_cesa_ahash_complete(struct crypto_async_request *req)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
atomic_sub(ahashreq->nbytes, &engine->load);
|
||||
}
|
||||
|
||||
static void mv_cesa_ahash_prepare(struct crypto_async_request *req,
|
||||
|
||||
Reference in New Issue
Block a user