linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch 2.6] dm-crypt: zero key before freeing it
@ 2006-01-04 20:08 Stefan Rompf
  2006-01-04 20:09 ` Arjan van de Ven
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Stefan Rompf @ 2006-01-04 20:08 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Clemens Fruhwirth, linux-kernel, stable

Hi Andrew,

dm-crypt does not clear struct crypt_config before freeing it. Thus, 
information on the key could leak f.e. to a swsusp image even after the 
encrypted device has been removed. The attached patch against 2.6.14 / 2.6.15 
fixes it.

Signed-off-by: Stefan Rompf <stefan@loplof.de>
Acked-by: Clemens Fruhwirth <clemens@endorphin.org>

--- linux-2.6.14.4/drivers/md/dm-crypt.c.old	2005-12-16 18:27:05.000000000 +0100
+++ linux-2.6.14.4/drivers/md/dm-crypt.c	2005-12-28 12:49:13.000000000 +0100
@@ -694,6 +694,7 @@ bad3:
 bad2:
 	crypto_free_tfm(tfm);
 bad1:
+	memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
 	kfree(cc);
 	return -EINVAL;
 }
@@ -710,6 +711,7 @@ static void crypt_dtr(struct dm_target *
 		cc->iv_gen_ops->dtr(cc);
 	crypto_free_tfm(cc->tfm);
 	dm_put_device(ti, cc->dev);
+	memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
 	kfree(cc);
 }
 


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-01-24 23:03 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-04 20:08 [Patch 2.6] dm-crypt: zero key before freeing it Stefan Rompf
2006-01-04 20:09 ` Arjan van de Ven
2006-01-04 20:26   ` Stefan Rompf
2006-01-04 20:28     ` Randy.Dunlap
2006-01-04 20:41       ` Jörn Engel
2006-01-04 20:43         ` Randy.Dunlap
2006-01-04 21:15           ` [stable] " Greg KH
2006-01-04 21:44             ` [Patch 2.6] dm-crypt: Zero key material before free to avoid information leak Stefan Rompf
2006-01-24  4:49 ` [Patch 2.6] dm-crypt: zero key before freeing it Neil Brown
2006-01-24 21:29   ` Stefan Rompf
2006-01-24 21:44     ` Neil Brown
2006-01-24 23:03 ` Phillip Susi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).