Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	Bob Copeland <bcopeland@gmail.com>
Subject: [PATCH] mac80211: disable beacons before removing the associated interface
Date: Wed, 29 Jul 2009 10:13:03 +0200	[thread overview]
Message-ID: <1248855183.13742.16.camel@johannes.local> (raw)

From: Bob Copeland <me@bobcopeland.com>

When downing interfaces, it's a good idea to tell the driver to
stop sending beacons; that way the driver doesn't need special
code in ops->remove_interface() when it should already handle the
case in bss_info_changed().

This fixes a potential crash with at least ath5k since the vif
pointer will be nullified while beacon interrupts are still active.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/iface.c |   10 ++++++++++
 net/mac80211/main.c  |    3 ++-
 net/mac80211/pm.c    |    4 ++++
 3 files changed, 16 insertions(+), 1 deletion(-)

--- wireless-testing.orig/net/mac80211/iface.c	2009-07-29 10:06:06.000000000 +0200
+++ wireless-testing/net/mac80211/iface.c	2009-07-29 10:11:35.000000000 +0200
@@ -522,6 +522,16 @@ static int ieee80211_stop(struct net_dev
 				ieee80211_scan_completed(&local->hw, true);
 		}
 
+		/*
+		 * Disable beaconing for AP and mesh, IBSS can't
+		 * still be joined to a network at this point.
+		 */
+		if (sdata->vif.type == NL80211_IFTYPE_AP ||
+		    sdata->vif.type == NL80211_IFTYPE_MESH_POINT) {
+			ieee80211_bss_info_change_notify(sdata,
+				BSS_CHANGED_BEACON_ENABLED);
+		}
+
 		conf.vif = &sdata->vif;
 		conf.type = sdata->vif.type;
 		conf.mac_addr = dev->dev_addr;
--- wireless-testing.orig/net/mac80211/main.c	2009-07-29 10:06:06.000000000 +0200
+++ wireless-testing/net/mac80211/main.c	2009-07-29 10:11:35.000000000 +0200
@@ -198,7 +198,8 @@ void ieee80211_bss_info_change_notify(st
 	}
 
 	if (changed & BSS_CHANGED_BEACON_ENABLED) {
-		if (test_bit(SCAN_SW_SCANNING, &local->scanning)) {
+		if (local->quiescing || !netif_running(sdata->dev) ||
+		    test_bit(SCAN_SW_SCANNING, &local->scanning)) {
 			sdata->vif.bss_conf.enable_beacon = false;
 		} else {
 			/*
--- wireless-testing.orig/net/mac80211/pm.c	2009-07-29 10:06:06.000000000 +0200
+++ wireless-testing/net/mac80211/pm.c	2009-07-29 10:11:35.000000000 +0200
@@ -96,6 +96,10 @@ int __ieee80211_suspend(struct ieee80211
 		if (!netif_running(sdata->dev))
 			continue;
 
+		/* disable beaconing */
+		ieee80211_bss_info_change_notify(sdata,
+			BSS_CHANGED_BEACON_ENABLED);
+
 		conf.vif = &sdata->vif;
 		conf.type = sdata->vif.type;
 		conf.mac_addr = sdata->dev->dev_addr;



                 reply	other threads:[~2009-07-29  8:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1248855183.13742.16.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=bcopeland@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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