Skip to contentSkip to conversation

mac80211: fix panic when using hardware WEP

PATCH In review Pavel Roskin 2 participants 2 messages Jun 2, 2008 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix panic when using hardware WEP

57ccbb1cbe3f8e10a500ff8b9fb26dc1a542fe99 misplaced code for setting hardware WEP keys. Move it back. This fixes kernel panic in b43 if WEP is used and hardware encryption is enabled.

---

 net/mac80211/wep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/wep.c +1 -1
index c9fd129..e7b6344 100644
@@ -335,10 +335,10 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
 	info->control.icv_len = WEP_ICV_LEN;
 
 	if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
-		info->control.hw_key = &tx->key->conf;
 		if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
 			return -1;
 	} else {
+		info->control.hw_key = &tx->key->conf;
 		if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
 			if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
 				return -1;
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Pavel Roskin

57ccbb1cbe3f8e10a500ff8b9fb26dc1a542fe99 misplaced code for setting hardware WEP keys. Move it back. This fixes kernel panic in b43 if WEP is used and hardware encryption is enabled.

Oh wow, yes, sorry about that, and thanks for tracking it down!

Quoted 1 line
Quoted 22 lines

---

 net/mac80211/wep.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/mac80211/wep.c +1 -1
index c9fd129..e7b6344 100644
@@ -335,10 +335,10 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
 	info->control.icv_len = WEP_ICV_LEN;
 
 	if (!(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) {
-		info->control.hw_key = &tx->key->conf;
 		if (ieee80211_wep_encrypt(tx->local, skb, tx->key))
 			return -1;
 	} else {
+		info->control.hw_key = &tx->key->conf;
 		if (tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
 			if (!ieee80211_wep_add_iv(tx->local, skb, tx->key))
 				return -1;