All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
@ 2008-05-17 18:35 Helmut Schaa
  2008-05-18 10:37 ` Tomas Winkler
  0 siblings, 1 reply; 8+ messages in thread
From: Helmut Schaa @ 2008-05-17 18:35 UTC (permalink / raw)
  To: John Linville; +Cc: Johannes Berg, Larry Finger, linux-wireless

Fix a possible NULL pointer dereference in ieee80211_compatible_rates
introduced in the patch "mac80211: fix association with some APs".

Signed-off-by: Helmut Schaa <hschaa@suse.de>
---

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 76ad4ed..2642551 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -664,15 +664,22 @@ static int ieee80211_compatible_rates(struct  
ieee80211_sta_bss *bss,
  	int i, j, count;
  	*rates = 0;
  	count = 0;
-	for (i = 0; i < bss->supp_rates_len; i++) {
-		int rate = (bss->supp_rates[i] & 0x7F) * 5;

-		for (j = 0; j < sband->n_bitrates; j++)
-			if (sband->bitrates[j].bitrate == rate) {
-				*rates |= BIT(j);
-				count++;
-				break;
-			}
+	if (bss) {
+		for (i = 0; i < bss->supp_rates_len; i++) {
+			int rate = (bss->supp_rates[i] & 0x7F) * 5;
+
+			for (j = 0; j < sband->n_bitrates; j++)
+				if (sband->bitrates[j].bitrate == rate) {
+					*rates |= BIT(j);
+					count++;
+					break;
+				}
+		}
+	} else {
+		for (i = 0; i < sband->n_bitrates; i++)
+			*rates |= BIT(i);
+		count = sband->n_bitrates;
  	}

  	return count;


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-05-19 16:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-17 18:35 [PATCHv2] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates Helmut Schaa
2008-05-18 10:37 ` Tomas Winkler
2008-05-18 13:32   ` Dan Williams
2008-05-18 15:14     ` Larry Finger
2008-05-19 11:07       ` Dan Williams
2008-05-19 11:37   ` Helmut Schaa
2008-05-19 12:41   ` Johannes Berg
2008-05-19 16:44     ` Tomas Winkler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.