From: Emmanuel Grumbach Date: Thu, 26 Jun 2008 09:13:46 +0000 (+0300) Subject: mac80211: fix an oops in several failure paths in key allocation X-Git-Tag: v2.6.26-rc9~84^2~25 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=00eb7fe77eb455f807c396f9917f0f623d4c84bb;p=linux-2.6-omap-h63xx.git mac80211: fix an oops in several failure paths in key allocation This patch fixes an oops in several failure paths in key allocation. This Oops occurs when freeing a key that has not been linked yet, so the key->sdata is not set. Signed-off-by: Emmanuel Grumbach Signed-off-by: Tomas Winkler Acked-by: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 150d66dbda9..220e83be3ef 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -380,6 +380,15 @@ void ieee80211_key_free(struct ieee80211_key *key) if (!key) return; + if (!key->sdata) { + /* The key has not been linked yet, simply free it + * and don't Oops */ + if (key->conf.alg == ALG_CCMP) + ieee80211_aes_key_free(key->u.ccmp.tfm); + kfree(key); + return; + } + spin_lock_irqsave(&key->sdata->local->key_lock, flags); __ieee80211_key_free(key); spin_unlock_irqrestore(&key->sdata->local->key_lock, flags);