[PATCH 4.14 46/67] crypto: lrw - Free rctx->ext with kzfree

From: Greg Kroah-Hartman
Date: Fri Apr 06 2018 - 10:16:23 EST


4.14-stable review patch. If anyone has any objections, please let me know.

------------------

From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

commit 8c9bdab21289c211ca1ca6a5f9b7537b4a600a02 upstream.

The buffer rctx->ext contains potentially sensitive data and should
be freed with kzfree.

Cc: <stable@xxxxxxxxxxxxxxx>
Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher")
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
crypto/lrw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -313,7 +313,7 @@ static void exit_crypt(struct skcipher_r
rctx->left = 0;

if (rctx->ext)
- kfree(rctx->ext);
+ kzfree(rctx->ext);
}

static int do_encrypt(struct skcipher_request *req, int err)