mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
crypto: chainiv - Invoke completion function
When chainiv postpones requests it never calls their completion functions. This causes symptoms such as memory leaks when IPsec is in use. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6329d3021b
commit
872ac8743c
1 changed files with 8 additions and 2 deletions
|
@ -117,6 +117,7 @@ static int chainiv_init(struct crypto_tfm *tfm)
|
||||||
static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx)
|
static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx)
|
||||||
{
|
{
|
||||||
int queued;
|
int queued;
|
||||||
|
int err = ctx->err;
|
||||||
|
|
||||||
if (!ctx->queue.qlen) {
|
if (!ctx->queue.qlen) {
|
||||||
smp_mb__before_clear_bit();
|
smp_mb__before_clear_bit();
|
||||||
|
@ -131,7 +132,7 @@ static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx)
|
||||||
BUG_ON(!queued);
|
BUG_ON(!queued);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return ctx->err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int async_chainiv_postpone_request(struct skcipher_givcrypt_request *req)
|
static int async_chainiv_postpone_request(struct skcipher_givcrypt_request *req)
|
||||||
|
@ -227,6 +228,7 @@ static void async_chainiv_do_postponed(struct work_struct *work)
|
||||||
postponed);
|
postponed);
|
||||||
struct skcipher_givcrypt_request *req;
|
struct skcipher_givcrypt_request *req;
|
||||||
struct ablkcipher_request *subreq;
|
struct ablkcipher_request *subreq;
|
||||||
|
int err;
|
||||||
|
|
||||||
/* Only handle one request at a time to avoid hogging keventd. */
|
/* Only handle one request at a time to avoid hogging keventd. */
|
||||||
spin_lock_bh(&ctx->lock);
|
spin_lock_bh(&ctx->lock);
|
||||||
|
@ -241,7 +243,11 @@ static void async_chainiv_do_postponed(struct work_struct *work)
|
||||||
subreq = skcipher_givcrypt_reqctx(req);
|
subreq = skcipher_givcrypt_reqctx(req);
|
||||||
subreq->base.flags |= CRYPTO_TFM_REQ_MAY_SLEEP;
|
subreq->base.flags |= CRYPTO_TFM_REQ_MAY_SLEEP;
|
||||||
|
|
||||||
async_chainiv_givencrypt_tail(req);
|
err = async_chainiv_givencrypt_tail(req);
|
||||||
|
|
||||||
|
local_bh_disable();
|
||||||
|
skcipher_givcrypt_complete(req, err);
|
||||||
|
local_bh_enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int async_chainiv_init(struct crypto_tfm *tfm)
|
static int async_chainiv_init(struct crypto_tfm *tfm)
|
||||||
|
|
Loading…
Reference in a new issue