[PATCH] crypto: hash - initializing memory buffer for keys

From: Kangjie Lu
Date: Fri Oct 18 2019 - 01:05:09 EST


"ctx" is uninitialized. To avoid undefined behaviors or memory
disclosures, we better initialize it.

Signed-off-by: Kangjie Lu <kjlu@xxxxxxx>
---
crypto/algif_hash.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 178f4cd75ef1..129a124e5056 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -433,6 +433,7 @@ static int hash_accept_parent_nokey(void *private, struct sock *sk)
ctx = sock_kmalloc(sk, len, GFP_KERNEL);
if (!ctx)
return -ENOMEM;
+ memset(ctx, 0, len);

ctx->result = NULL;
ctx->len = len;
--
2.17.1