dm crypt: fix free of bad values after tfm allocation failure
PATCH 1/1 dm crypt: fix free of bad values after tfm allocation failure
If crypt_alloc_tfms() had to allocate multiple tfms and it failed before the last allocation, then it would call crypt_free_tfms() and free pointers from uninitialized memory. Fix by allocating zeroed memory.
Signed-off-by Eric Biggers <[email protected]>
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -1453,7 +1453,7 @@ static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode)unsigned i;int err; - cc->tfms =kmalloc (cc->tfms_count *sizeof (struct crypto_skcipher *), + cc->tfms =kzalloc (cc->tfms_count *sizeof (struct crypto_skcipher *),GFP_KERNEL );if (!cc->tfms)return -ENOMEM ;
Signature · 1 line
2.8.0.rc3.226.g39d4020