]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
crypto: drbg - fix freeing of resources
authorStephan Mueller <smueller@chronox.de>
Thu, 14 Sep 2017 15:10:28 +0000 (17:10 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 12 Oct 2017 21:20:17 +0000 (16:20 -0500)
BugLink: http://bugs.launchpad.net/bugs/1721777
commit bd6227a150fdb56e7bb734976ef6e53a2c1cb334 upstream.

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: 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
crypto/drbg.c

index 633a88e93ab0c421b7b01a041726ad9563ce2d49..70018397e59abf10d125864f5770c41cd13f2021 100644 (file)
@@ -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;