Skip to contentSkip to conversation

mac80211: fix NULL pointer dereference in ieee80211_compatible_rates

PATCH Superseded Helmut Schaa 3 participants 4 messages May 19, 2008 mac80211

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 mac80211: fix NULL pointer dereference in ieee80211_compatible_rates

Fix a possible NULL pointer dereference in ieee80211_compatible_rates introduced in the patch "mac80211: fix association with some APs". If no bss is available just use all supported rates in the association request.

---

net/mac80211/mlme.c +10 -4
index 76ad4ed..7aff784 100644
@@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
 		if (bss->wmm_ie)
 			wmm = 1;
 		ieee80211_rx_bss_put(dev, bss);
+
+		/* get all rates supported by the device and the AP as
+		 * some APs don't like getting a superset of their rates
+		 * in the association request (e.g. D-Link DAP 1353 in
+		 * b-only mode) */
+		rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+	} else {
+		rates = ~0;
+		rates_len = sband->n_bitrates;
 	}
 
 	mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
@@ -752,10 +761,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
 	*pos++ = ifsta->ssid_len;
 	memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
-	/* all supported rates should be added here but some APs
-	 * (e.g. D-Link DAP 1353 in b-only mode) don't like that
-	 * Therefore only add rates the AP supports */
-	rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+	/* add all rates which were marked to be used above */
 	supp_rates_len = rates_len;
 	if (supp_rates_len > 8)
 		supp_rates_len = 8;
maintainer Acked-by on v4 1/1
#1 lore raw
Quoted 5 lines · Helmut Schaa

Fix a possible NULL pointer dereference in ieee80211_compatible_rates introduced in the patch "mac80211: fix association with some APs". If no bss is available just use all supported rates in the association request.

Thanks.

Quoted 35 lines

---

net/mac80211/mlme.c +10 -4
index 76ad4ed..7aff784 100644
@@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
 		if (bss->wmm_ie)
 			wmm = 1;
 		ieee80211_rx_bss_put(dev, bss);
+
+		/* get all rates supported by the device and the AP as
+		 * some APs don't like getting a superset of their rates
+		 * in the association request (e.g. D-Link DAP 1353 in
+		 * b-only mode) */
+		rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+	} else {
+		rates = ~0;
+		rates_len = sband->n_bitrates;
 	}
 
 	mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
@@ -752,10 +761,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
 	*pos++ = ifsta->ssid_len;
 	memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
-	/* all supported rates should be added here but some APs
-	 * (e.g. D-Link DAP 1353 in b-only mode) don't like that
-	 * Therefore only add rates the AP supports */
-	rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+	/* add all rates which were marked to be used above */
 	supp_rates_len = rates_len;
 	if (supp_rates_len > 8)
 		supp_rates_len = 8;
#2 lore raw
In reply to Helmut Schaa
Quoted 12 lines · Helmut Schaa

Fix a possible NULL pointer dereference in ieee80211_compatible_rates introduced in the patch "mac80211: fix association with some APs". If no bss is available just use all supported rates in the association request.

---

net/mac80211/mlme.c +0 -0
index 76ad4ed..7aff784 100644

net/mac80211/mlme.c static void ieee80211_send_assoc(struct net_device *dev, · line 730

Quoted 9 lines
net/mac80211/mlme.c +6 -0
@@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
               if (bss->wmm_ie)
                       wmm = 1;
               ieee80211_rx_bss_put(dev, bss);
+
+               /* get all rates supported by the device and the AP as
+                * some APs don't like getting a superset of their rates
+                * in the association request (e.g. D-Link DAP 1353 in
+                * b-only mode) */
+               rates_len = ieee80211_compatible_rates(bss, sband, &rates);

Shuldn' t this call ieee80211_rx_bss_put(dev, bss); after calling ieee80211_compatible_rates()

Quoted 23 lines
net/mac80211/mlme.c +4 -5
+       } else {
+               rates = ~0;
+               rates_len = sband->n_bitrates;
       }
 
       mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
@@ -752,10 +761,7 @@ static void ieee80211_send_assoc(struct net_device *dev,
       *pos++ = ifsta->ssid_len;
       memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
-       /* all supported rates should be added here but some APs
-        * (e.g. D-Link DAP 1353 in b-only mode) don't like that
-        * Therefore only add rates the AP supports */
-       rates_len = ieee80211_compatible_rates(bss, sband, &rates);
+       /* add all rates which were marked to be used above */
       supp_rates_len = rates_len;
       if (supp_rates_len > 8)
               supp_rates_len = 8;
--

To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw
Quoted 17 lines · Tomas Winkler
Quoted 16 lines · Helmut Schaa

Fix a possible NULL pointer dereference in ieee80211_compatible_rates introduced in the patch "mac80211: fix association with some APs". If no bss is available just use all supported rates in the association request.

---

net/mac80211/mlme.c +1 -0
index 76ad4ed..7aff784 100644
@@ -722,6 +722,15 @@ static void ieee80211_send_assoc(struct net_device *dev,
               if (bss->wmm_ie)
                       wmm = 1;
               ieee80211_rx_bss_put(dev, bss);
+
Quoted 8 lines

net/mac80211/mlme.c static void ieee80211_send_assoc(struct net_device *dev, · line 730

Quoted 5 lines
net/mac80211/mlme.c +5 -0
+               /* get all rates supported by the device and the AP as
+                * some APs don't like getting a superset of their rates
+                * in the association request (e.g. D-Link DAP 1353 in
+                * b-only mode) */
+               rates_len = ieee80211_compatible_rates(bss, sband, &rates);

Shuldn' t this call ieee80211_rx_bss_put(dev, bss); after calling ieee80211_compatible_rates()

Ahrg. Umm, yes, of course. D'oh. I really need to look at things better, thanks.

johannes