summaryrefslogtreecommitdiff
path: root/crypto/drbg.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2017-09-14 17:10:28 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2017-09-20 17:42:29 +0800
commitdcec1f1c58841a6dfdd8898674bd211ea4525331 (patch)
tree346cc13746abb3d7f8cfc1118d56341741c24a84 /crypto/drbg.c
parentfc628d5460223588ea5aff6e038655f2f910e2dd (diff)
downloadlinux-crypto-dcec1f1c58841a6dfdd8898674bd211ea4525331.tar.gz
linux-crypto-dcec1f1c58841a6dfdd8898674bd211ea4525331.zip
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: faba028f3f7b4 ("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>
Diffstat (limited to 'crypto/drbg.c')
-rw-r--r--crypto/drbg.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 633a88e9..70018397 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1133,10 +1133,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
{
if (!drbg)
return;
- kzfree(drbg->V);
- drbg->Vbuf = NULL;
- kzfree(drbg->C);
- drbg->Cbuf = NULL;
+ kzfree(drbg->Vbuf);
+ drbg->V = NULL;
+ kzfree(drbg->Cbuf);
+ drbg->C = NULL;
kzfree(drbg->scratchpadbuf);
drbg->scratchpadbuf = NULL;
drbg->reseed_ctr = 0;