linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Helmut Schaa <hschaa@suse.de>
To: "Tomas Winkler" <tomasw@gmail.com>
Cc: "John Linville" <linville@tuxdriver.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Larry Finger" <Larry.Finger@lwfinger.net>,
	linux-wireless@vger.kernel.org
Subject: Re: [PATCHv2] mac80211: fix NULL pointer dereference in ieee80211_compatible_rates
Date: Mon, 19 May 2008 13:37:08 +0200	[thread overview]
Message-ID: <200805191337.09535.hschaa@suse.de> (raw)
In-Reply-To: <1ba2fa240805180337h35bc3244od619e78c0d95d895@mail.gmail.com>

Am Sonntag, 18. Mai 2008 12:37:23 schrieb Tomas Winkler:
> Again, mac should rather solve the problem that we do not connect to
> AP's that are not in the BSS list

I just tried that approach (see patch below) and could not find a regression 
at a first glance. Nevertheless I'm not sure in which situations a bss is
removed from the list and if this approach would cause a regression?

Regards,
Helmut


diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 76ad4ed..8595bfd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -678,7 +678,7 @@ static int ieee80211_compatible_rates(struct 
ieee80211_sta_bss *bss,
 	return count;
 }
 
-static void ieee80211_send_assoc(struct net_device *dev,
+static int ieee80211_send_assoc(struct net_device *dev,
 				 struct ieee80211_if_sta *ifsta)
 {
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
@@ -716,6 +716,10 @@ static void ieee80211_send_assoc(struct net_device *dev,
 	bss = ieee80211_rx_bss_get(dev, ifsta->bssid,
 				   local->hw.conf.channel->center_freq,
 				   ifsta->ssid, ifsta->ssid_len);
+
+	if (!bss)
+		return 1;
+
 	if (bss) {
 		if (bss->capability & WLAN_CAPABILITY_PRIVACY)
 			capab |= WLAN_CAPABILITY_PRIVACY;
@@ -829,6 +833,8 @@ static void ieee80211_send_assoc(struct net_device *dev,
 		memcpy(ifsta->assocreq_ies, ies, ifsta->assocreq_ies_len);
 
 	ieee80211_sta_tx(dev, skb, 0);
+
+	return 0;
 }
 
 
@@ -945,7 +951,11 @@ static void ieee80211_associate(struct net_device *dev,
 		return;
 	}
 
-	ieee80211_send_assoc(dev, ifsta);
+	if (ieee80211_send_assoc(dev, ifsta)) {
+		printk(KERN_DEBUG "%s: send association request failed", dev->name);
+		ifsta->state = IEEE80211_DISABLED;
+		return;
+	}
 
 	mod_timer(&ifsta->timer, jiffies + IEEE80211_ASSOC_TIMEOUT);
 }

  parent reply	other threads:[~2008-05-19 11:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-05-19 12:41   ` Johannes Berg
2008-05-19 16:44     ` Tomas Winkler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200805191337.09535.hschaa@suse.de \
    --to=hschaa@suse.de \
    --cc=Larry.Finger@lwfinger.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomasw@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).