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


Groups > linux.kernel > #1583545 > unrolled thread

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

Started byColin King <colin.king@canonical.com>
First post2017-02-17 17:00 +0100
Last post2017-02-27 11:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromColin King <colin.king@canonical.com>
Date2017-02-17 17:00 +0100
Subject[PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated
Message-ID<tbT6V-6aX-1@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


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

FromHerbert Xu <herbert@gondor.apana.org.au>
Date2017-02-27 11:50 +0100
SubjectRe: [PATCH] crypto: cavium: fix leak on curr if curr->head fails to be allocated
Message-ID<tfr2p-4lJ-5@gated-at.bofh.it>
In reply to#1583545
On Fri, Feb 17, 2017 at 03:57:43PM +0000, Colin King wrote:
> 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>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web