mirror of https://gitee.com/openkylin/linux.git
crypto: talitos - Stop leaking memory in error path
free edescriptor when returning error (such as -EAGAIN). Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Acked-by: Lee Nipper <lee.nipper@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
586725f860
commit
fa86a26795
|
@ -880,7 +880,7 @@ static int ipsec_esp(struct ipsec_esp_edesc *edesc, struct aead_request *areq,
|
|||
unsigned int cryptlen = areq->cryptlen;
|
||||
unsigned int authsize = ctx->authsize;
|
||||
unsigned int ivsize;
|
||||
int sg_count;
|
||||
int sg_count, ret;
|
||||
|
||||
/* hmac key */
|
||||
map_single_talitos_ptr(dev, &desc->ptr[0], ctx->authkeylen, &ctx->key,
|
||||
|
@ -984,7 +984,12 @@ static int ipsec_esp(struct ipsec_esp_edesc *edesc, struct aead_request *areq,
|
|||
map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv, 0,
|
||||
DMA_FROM_DEVICE);
|
||||
|
||||
return talitos_submit(dev, desc, callback, areq);
|
||||
ret = talitos_submit(dev, desc, callback, areq);
|
||||
if (ret != -EINPROGRESS) {
|
||||
ipsec_esp_unmap(dev, edesc, areq);
|
||||
kfree(edesc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue