linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Larry H." <research@subreption.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Rik van Riel <riel@redhat.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	pageexec@freemail.hu, Linus Torvalds <torvalds@osdl.org>
Subject: [PATCH] Use kzfree in mac80211 key handling to enforce data sanitization
Date: Sat, 30 May 2009 18:58:01 -0700	[thread overview]
Message-ID: <20090531015801.GB8941@oblivion.subreption.com> (raw)

[PATCH] Use kzfree in mac80211 key handling to enforce data sanitization

This patch replaces the kfree() calls within the mac80211 WEP RC4 key
handling and ieee80211 management APIs with kzfree(), to enforce
sanitization of the key buffer contents.

This prevents the keys from persisting on memory, potentially
leaking to other kernel users after re-allocation of the memory by
the LIFO allocators, or in coldboot attack scenarios. Information can be
leaked as well due to use of uninitialized variables, or other bugs.

This patch doesn't affect fastpaths.

Signed-off-by: Larry Highsmith <research@subreption.com>

Index: linux-2.6/net/mac80211/key.c
===================================================================
--- linux-2.6.orig/net/mac80211/key.c
+++ linux-2.6/net/mac80211/key.c
@@ -304,7 +304,7 @@ struct ieee80211_key *ieee80211_key_allo
 		 */
 		key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data);
 		if (!key->u.ccmp.tfm) {
-			kfree(key);
+			kzfree(key);
 			return NULL;
 		}
 	}
@@ -404,7 +404,7 @@ void ieee80211_key_free(struct ieee80211
 		 * and don't Oops */
 		if (key->conf.alg == ALG_CCMP)
 			ieee80211_aes_key_free(key->u.ccmp.tfm);
-		kfree(key);
+		kzfree(key);
 		return;
 	}
 
@@ -464,7 +464,7 @@ static void __ieee80211_key_destroy(stru
 		ieee80211_aes_key_free(key->u.ccmp.tfm);
 	ieee80211_debugfs_key_remove(key);
 
-	kfree(key);
+	kzfree(key);
 }
 
 static void __ieee80211_key_todo(void)
Index: linux-2.6/net/mac80211/wep.c
===================================================================
--- linux-2.6.orig/net/mac80211/wep.c
+++ linux-2.6/net/mac80211/wep.c
@@ -161,7 +161,7 @@ int ieee80211_wep_encrypt(struct ieee802
 
 	iv = ieee80211_wep_add_iv(local, skb, key);
 	if (!iv) {
-		kfree(rc4key);
+		kzfree(rc4key);
 		return -1;
 	}
 
@@ -179,7 +179,7 @@ int ieee80211_wep_encrypt(struct ieee802
 	ieee80211_wep_encrypt_data(local->wep_tx_tfm, rc4key, klen,
 				   iv + WEP_IV_LEN, len);
 
-	kfree(rc4key);
+	kzfree(rc4key);
 
 	return 0;
 }
@@ -258,7 +258,7 @@ int ieee80211_wep_decrypt(struct ieee802
 				       len))
 		ret = -1;
 
-	kfree(rc4key);
+	kzfree(rc4key);
 
 	/* Trim ICV */
 	skb_trim(skb, skb->len - WEP_ICV_LEN);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2009-05-31  2:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-31  1:58 Larry H. [this message]
2009-05-31  2:14 ` Rik van Riel

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=20090531015801.GB8941@oblivion.subreption.com \
    --to=research@subreption.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pageexec@freemail.hu \
    --cc=riel@redhat.com \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox