Skip to contentSkip to conversation

wireless: Fix WARN_ON() with ieee802.11b

PATCH In review Ivo van Doorn 3 participants 6 messages Feb 2, 2008 – Feb 3, 2008 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wireless: Fix WARN_ON() with ieee802.11b

When the driver registers a IEEE80211_BAND_2GHZ band,
it can either be 802.11b or 802.11g. But when 802.11b rates are registered "want" will be 3 (since 4 rates are being registered, and each of those 4 rates will decrease "want").
Since this is a correct situation, there is no need to trigger a WARN_ON() for this.

---

net/wireless/util.c +1 -1
index 0dcccbf..5304c62 100644
@@ -80,7 +80,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
 				sband->bitrates[i].flags |=
 					IEEE80211_RATE_ERP_G;
 		}
-		WARN_ON(want != 0 && want != 6);
+		WARN_ON(want != 0 && want != 3 && want != 6);
 		break;
 	case IEEE80211_NUM_BANDS:
 		WARN_ON(1);
Acked-by on v1 1/1
#1 lore raw

2008/2/3, Ivo van Doorn <[email protected]>:

Quoted 15 lines

When the driver registers a IEEE80211_BAND_2GHZ band,
it can either be 802.11b or 802.11g. But when 802.11b rates are registered "want" will be 3 (since 4 rates are being registered, and each of those 4 rates will decrease "want").
Since this is a correct situation, there is no need to trigger a WARN_ON() for this.

---

net/wireless/util.c +0 -0
index 0dcccbf..5304c62 100644

net/wireless/util.c static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, · line 86

Quoted 8 lines
net/wireless/util.c +1 -1
@@ -80,7 +80,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
                                sband->bitrates[i].flags |=
                                        IEEE80211_RATE_ERP_G;
                }
-               WARN_ON(want != 0 && want != 6);
+               WARN_ON(want != 0 && want != 3 && want != 6);
                break;
        case IEEE80211_NUM_BANDS:
                WARN_ON(1);

Had the same problem when registering an AR5211 card (a/b only), this patch fixes it ;-)

Signature · 3 lines
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
maintainer
#2 lore raw
In reply to Ivo van Doorn
Quoted 5 lines

When the driver registers a IEEE80211_BAND_2GHZ band,
it can either be 802.11b or 802.11g. But when 802.11b rates are registered "want" will be 3 (since 4 rates are being registered, and each of those 4 rates will decrease "want").

Huh, yeah, you're right, this is a thinko.

net/wireless/util.c static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, · line 83

Quoted 2 lines
net/wireless/util.c +1 -1
-		WARN_ON(want != 0 && want != 6);
+		WARN_ON(want != 0 && want != 3 && want != 6);

However, I think it should just be

		WARN_ON(want != 0 && want != 3);

6 just doesn't make sense, does it?

johannes

#3 lore raw
Quoted 8 lines · Johannes Berg
Quoted 5 lines

When the driver registers a IEEE80211_BAND_2GHZ band,
it can either be 802.11b or 802.11g. But when 802.11b rates are registered "want" will be 3 (since 4 rates are being registered, and each of those 4 rates will decrease "want").

Huh, yeah, you're right, this is a thinko.

Quoted 8 lines

net/wireless/util.c static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, · line 83

Quoted 2 lines
net/wireless/util.c +1 -1
-		WARN_ON(want != 0 && want != 6);
+		WARN_ON(want != 0 && want != 3 && want != 6);

However, I think it should just be

		WARN_ON(want != 0 && want != 3);

6 just doesn't make sense, does it?

Well from your code it seemed that you only made 1Mbit mandatory for 802.11b. So if you want to make all b rates mandatory then the 6 check should indeed be removed.
But shouldn't the 2Mbit, 5.5Mbit and 11Mbit set as IEEE80211_RATE_MANDATORY_B as well?

Ivo

maintainer
#4 lore raw
Quoted 6 lines

Well from your code it seemed that you only made 1Mbit mandatory for 802.11b. So if you want to make all b rates mandatory then the 6 check should indeed be removed.
But shouldn't the 2Mbit, 5.5Mbit and 11Mbit set as IEEE80211_RATE_MANDATORY_B as well?

Ah, right, no, those aren't mandatory afaict so your patch is correct. This is only a fairly lax sanity check anyway.

johannes

maintainer Acked-by on v1 1/1
#5 lore raw
In reply to Ivo van Doorn
Quoted 8 lines · Ivo van Doorn

When the driver registers a IEEE80211_BAND_2GHZ band,
it can either be 802.11b or 802.11g. But when 802.11b rates are registered "want" will be 3 (since 4 rates are being registered, and each of those 4 rates will decrease "want").
Since this is a correct situation, there is no need to trigger a WARN_ON() for this.

Quoted 15 lines

---

net/wireless/util.c +1 -1
index 0dcccbf..5304c62 100644
@@ -80,7 +80,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband,
 				sband->bitrates[i].flags |=
 					IEEE80211_RATE_ERP_G;
 		}
-		WARN_ON(want != 0 && want != 6);
+		WARN_ON(want != 0 && want != 3 && want != 6);
 		break;
 	case IEEE80211_NUM_BANDS:
 		WARN_ON(1);