Use kzfree in mac80211 key handling to enforce data sanitization
Subsystems (2)
PATCH 1/1 Use kzfree in mac80211 key handling to enforce data sanitization
[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.
net/mac80211/key.c +3 -3
@@ -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(struieee80211_aes_key_free (key->u.ccmp.tfm);ieee80211_debugfs_key_remove (key); -kfree (key); +kzfree (key); }static void __ieee80211_key_todo (void )
net/mac80211/wep.c +3 -3
@@ -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 ieee802ieee80211_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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Larry H.
[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 withkzfree(), to enforce sanitization of the key buffer contents.
Quoted 6 lines
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.
This seems to be essentially what Ingo proposed.
Clearing out a buffer that held a wifi key on free makes sense, even for systems that are not in paranoid mode.
Quoted 1 line
Signed-off-by Larry Highsmith <[email protected]>
Signature · 7 lines
All rights reversed. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>