Skip to contentSkip to conversation

b43: Fix hardware key index handling

PATCH In review Michael Buesch 3 participants 5 messages Aug 6, 2009 – Aug 7, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: Fix hardware key index handling

This fixes the hardware encryption keys index and array size handling.

Thanks to Gregor Kowski for reporting this issue.

---

This should probably go as a bugfix.
(Does this actually fix the PHY transmission errors? I don't see them anymore... Note that you need to enable debugging to see them.)

drivers/net/wireless/b43/b43.h +5 -2
Index: wireless-testing/drivers/net/wireless/b43/b43.h
===================================================================
@@ -493,6 +493,10 @@ enum {
 
 /* Max size of a security key */
 #define B43_SEC_KEYSIZE			16
+/* Max number of group keys */
+#define B43_NR_GROUP_KEYS		4
+/* Max number of pairwise keys */
+#define B43_NR_PAIRWISE_KEYS		50
 /* Security algorithms. */
 enum {
 	B43_SEC_ALGO_NONE = 0,	/* unencrypted, as of TX header. */
@@ -819,8 +823,7 @@ struct b43_wldev {
 
 	/* encryption/decryption */
 	u16 ktp;		/* Key table pointer */
-	u8 max_nr_keys;
-	struct b43_key key[58];
+	struct b43_key key[B43_NR_GROUP_KEYS * 2 + B43_NR_PAIRWISE_KEYS];
 
 	/* Firmware data */
 	struct b43_firmware fw;
drivers/net/wireless/b43/main.c +46 -50

189 lines not on this page · raw message

drivers/net/wireless/b43/xmit.c +2 -2
Index: wireless-testing/drivers/net/wireless/b43/xmit.c
===================================================================
@@ -237,7 +237,7 @@ int b43_generate_txhdr(struct b43_wldev 
 		int wlhdr_len;
 		size_t iv_len;
 
-		B43_WARN_ON(key_idx >= dev->max_nr_keys);
+		B43_WARN_ON(key_idx >= ARRAY_SIZE(dev->key));
 		key = &(dev->key[key_idx]);
 
 		if (unlikely(!key->keyconf)) {
@@ -578,7 +578,7 @@ void b43_rx(struct b43_wldev *dev, struc
 		 * key index, but the ucode passed it slightly different.
 		 */
 		keyidx = b43_kidx_to_raw(dev, keyidx);
-		B43_WARN_ON(keyidx >= dev->max_nr_keys);
+		B43_WARN_ON(keyidx >= ARRAY_SIZE(dev->key));
 
 		if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) {
 			wlhdr_len = ieee80211_hdrlen(fctl);
Signature · 1 line
Greetings, Michael.
#1 lore raw
Quoted 11 lines · Michael Buesch

This fixes the hardware encryption keys index and array size handling.

Thanks to Gregor Kowski for reporting this issue.

---

This should probably go as a bugfix.
(Does this actually fix the PHY transmission errors? I don't see them anymore... Note that you need to enable debugging to see them.)

I still see the PHY transmission errors. I had two of them and a "RX:
packet dropped" debug message within seconds of reloading b43 with this patch included.

Larry

#2 lore raw
Quoted 7 lines · On Thursday 06 August 2009 16:29:58 Larry Finger wrote:
Quoted 6 lines · Michael Buesch

This fixes the hardware encryption keys index and array size handling.

Thanks to Gregor Kowski for reporting this issue.

Quoted 7 lines
Quoted 5 lines

---

This should probably go as a bugfix.
(Does this actually fix the PHY transmission errors? I don't see them anymore... Note that you need to enable debugging to see them.)

I still see the PHY transmission errors.

Ah ok. I also have a new AP. Maybe that's why I'm not seeing it here. I'll try later further away from the AP. That would show them again then...

Quoted 3 lines

I had two of them and a "RX:
packet dropped" debug message within seconds of reloading b43 with this patch included.

Should be fine. This happens sometimes.
Connection and rekeying does work. (Rekeying might still break if there's heavy traffic. But that bug always was there. I think it's related to mac80211's key handling. I also saw it on intel wireless.)

Signature · 1 line
Greetings, Michael.
#3 lore raw
In reply to Michael Buesch
Quoted 11 lines · Michael Buesch

This fixes the hardware encryption keys index and array size handling.

Thanks to Gregor Kowski for reporting this issue.

---

This should probably go as a bugfix.
(Does this actually fix the PHY transmission errors? I don't see them anymore... Note that you need to enable debugging to see them.)

It's getting a bit late in the cycle, especially for a patch so large and (at least to me) non-obvious. What is the actual bug being fixed? What is the effect of leaving it for 2.6.32?

John

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
#4 lore raw
Quoted 9 lines · On Friday 07 August 2009 16:37:26 John W. Linville wrote:
Quoted 8 lines · Michael Buesch

This fixes the hardware encryption keys index and array size handling.

Thanks to Gregor Kowski for reporting this issue.

---

Quoted 7 lines
Quoted 3 lines

This should probably go as a bugfix.
(Does this actually fix the PHY transmission errors? I don't see them anymore... Note that you need to enable debugging to see them.)

It's getting a bit late in the cycle, especially for a patch so large and (at least to me) non-obvious. What is the actual bug being fixed? What is the effect of leaving it for 2.6.32?

AP mode might break under certain conditions (lots of STAs connected). Please leave it for .32

Signature · 1 line
Greetings, Michael.