summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2017-02-17 15:57:43 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2017-02-27 18:09:38 +0800
commitd80388eca1b476125755a811676f76f138bbbe28 (patch)
tree1e03bc2b83c18ea6a943ad9861194b1c76db469d /drivers/crypto
parent9bd829041b704e5e501ad5f5a9374a63426763fd (diff)
crypto: cavium - fix leak on curr if curr->head fails to be allocated
The exit path when curr->head cannot be allocated fails to kfree the earlier allocated curr. Fix this by kfree'ing it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/cavium/cpt/cptvf_main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/crypto/cavium/cpt/cptvf_main.c b/drivers/crypto/cavium/cpt/cptvf_main.c
index e50872e666d6..6ffc740c7431 100644
--- a/drivers/crypto/cavium/cpt/cptvf_main.c
+++ b/drivers/crypto/cavium/cpt/cptvf_main.c
@@ -242,6 +242,7 @@ static int alloc_command_queues(struct cpt_vf *cptvf,
if (!curr->head) {
dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n",
i, queue->nchunks);
+ kfree(curr);
goto cmd_qfail;
}