lkml.org 
[lkml]   [2017]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated
Date
From: Colin Ian King <colin.king@canonical.com>

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>
---
drivers/crypto/cavium/cpt/cptvf_main.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/cavium/cpt/cptvf_main.c b/drivers/crypto/cavium/cpt/cptvf_main.c
index 527bdc3..3247c7f 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;
}

--
2.10.2
\
 
 \ /
  Last update: 2017-02-17 16:58    [W:0.028 / U:0.148 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site