diff options
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r-- | drivers/md/dm-crypt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index cf6631056683..a601a427885c 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -690,6 +690,8 @@ bad3: | |||
690 | bad2: | 690 | bad2: |
691 | crypto_free_tfm(tfm); | 691 | crypto_free_tfm(tfm); |
692 | bad1: | 692 | bad1: |
693 | /* Must zero key material before freeing */ | ||
694 | memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); | ||
693 | kfree(cc); | 695 | kfree(cc); |
694 | return -EINVAL; | 696 | return -EINVAL; |
695 | } | 697 | } |
@@ -706,6 +708,9 @@ static void crypt_dtr(struct dm_target *ti) | |||
706 | cc->iv_gen_ops->dtr(cc); | 708 | cc->iv_gen_ops->dtr(cc); |
707 | crypto_free_tfm(cc->tfm); | 709 | crypto_free_tfm(cc->tfm); |
708 | dm_put_device(ti, cc->dev); | 710 | dm_put_device(ti, cc->dev); |
711 | |||
712 | /* Must zero key material before freeing */ | ||
713 | memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8)); | ||
709 | kfree(cc); | 714 | kfree(cc); |
710 | } | 715 | } |
711 | 716 | ||