Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583545

[PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated

From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated
Date 2017-02-17 17:00 +0100
Message-ID <tbT6V-6aX-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated Colin King <colin.king@canonical.com> - 2017-02-17 17:00 +0100
  Re: [PATCH] crypto: cavium: fix leak on curr if curr->head fails to  be allocated Herbert Xu <herbert@gondor.apana.org.au> - 2017-02-27 11:50 +0100

csiph-web