浏览代码

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>
Colin Ian King 8 年之前
父节点
当前提交
d80388eca1
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      drivers/crypto/cavium/cpt/cptvf_main.c

+ 1 - 0
drivers/crypto/cavium/cpt/cptvf_main.c

@@ -242,6 +242,7 @@ static int alloc_command_queues(struct cpt_vf *cptvf,
 			if (!curr->head) {
 			if (!curr->head) {
 				dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n",
 				dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n",
 					i, queue->nchunks);
 					i, queue->nchunks);
+				kfree(curr);
 				goto cmd_qfail;
 				goto cmd_qfail;
 			}
 			}