All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Rompf <stefan@loplof.de>
To: Greg KH <greg@kroah.com>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>,
	J?rn Engel <joern@wohnheim.fh-wedel.de>,
	linux-kernel@vger.kernel.org,
	Clemens Fruhwirth <clemens@endorphin.org>,
	stable@kernel.org, Arjan van de Ven <arjan@infradead.org>
Subject: [Patch 2.6] dm-crypt: Zero key material before free to avoid information leak
Date: Wed, 4 Jan 2006 22:44:57 +0100	[thread overview]
Message-ID: <200601042244.58683.stefan@loplof.de> (raw)
In-Reply-To: <20060104211526.GA12042@kroah.com>

Am Mittwoch 04 Januar 2006 22:15 schrieb Greg KH:

> Yes, Stefan, care to redo this with an updated changelog command?


dm-crypt should clear struct crypt_config before freeing it to
avoid information leak f.e. to a swsusp image.

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

--- linux-2.6.15/drivers/md/dm-crypt.c.orig	2006-01-04 01:01:16.000000000 +0100
+++ linux-2.6.15/drivers/md/dm-crypt.c	2006-01-04 22:35:13.000000000 +0100
@@ -690,6 +690,8 @@
 bad2:
 	crypto_free_tfm(tfm);
 bad1:
+	/* Zero key material before free to avoid information leak */
+	memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
 	kfree(cc);
 	return -EINVAL;
 }
@@ -706,6 +708,9 @@
 		cc->iv_gen_ops->dtr(cc);
 	crypto_free_tfm(cc->tfm);
 	dm_put_device(ti, cc->dev);
+
+	/* Zero key material before free to avoid information leak */
+	memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
 	kfree(cc);
 }
 

  reply	other threads:[~2006-01-04 21:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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             ` Stefan Rompf [this message]
2006-01-24  4:49 ` Neil Brown
2006-01-24 21:29   ` Stefan Rompf
2006-01-24 21:44     ` Neil Brown
2006-01-24 23:03 ` Phillip Susi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200601042244.58683.stefan@loplof.de \
    --to=stefan@loplof.de \
    --cc=arjan@infradead.org \
    --cc=clemens@endorphin.org \
    --cc=greg@kroah.com \
    --cc=joern@wohnheim.fh-wedel.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.