crypto: DRBG - fix freeing of resources
PATCH 1/1 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.
--- crypto/drbg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
crypto/drbg.c +4 -4
@@ -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 ;
Signature · 1 line
2.13.5
Herbert Xu
maintainerQuoted 11 lines · Stephan Müller
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 <[email protected]>CC Herbert Xu <[email protected]>Signed-off-by Stephan Mueller <[email protected]>
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt