aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2017-09-14 11:10:28 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2017-09-20 05:42:29 -0400
commitbd6227a150fdb56e7bb734976ef6e53a2c1cb334 (patch)
treea9944827084eba41168a6a96833f06c6b134afc5
parent2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e (diff)
crypto: drbg - fix freeing of resources
During the change to use aligned buffers, the deallocation code path was not updated correctly. The current code tries to free the aligned buffer pointer and not the original buffer pointer as it is supposed to. Thus, the code is updated to free the original buffer pointer and set the aligned buffer pointer that is used throughout the code to NULL. Fixes: 3cfc3b9721123 ("crypto: drbg - use aligned buffers") CC: <stable@vger.kernel.org> CC: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/drbg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 633a88e93ab0..70018397e59a 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1133,10 +1133,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
1133{ 1133{
1134 if (!drbg) 1134 if (!drbg)
1135 return; 1135 return;
1136 kzfree(drbg->V); 1136 kzfree(drbg->Vbuf);
1137 drbg->Vbuf = NULL; 1137 drbg->V = NULL;
1138 kzfree(drbg->C); 1138 kzfree(drbg->Cbuf);
1139 drbg->Cbuf = NULL; 1139 drbg->C = NULL;
1140 kzfree(drbg->scratchpadbuf); 1140 kzfree(drbg->scratchpadbuf);
1141 drbg->scratchpadbuf = NULL; 1141 drbg->scratchpadbuf = NULL;
1142 drbg->reseed_ctr = 0; 1142 drbg->reseed_ctr = 0;