From patchwork Wed Jul 29 08:13:03 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 38080 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6T8DeKL005500 for ; Wed, 29 Jul 2009 08:13:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbZG2INi (ORCPT ); Wed, 29 Jul 2009 04:13:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751514AbZG2INh (ORCPT ); Wed, 29 Jul 2009 04:13:37 -0400 Received: from xc.sipsolutions.net ([83.246.72.84]:56126 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751330AbZG2INg (ORCPT ); Wed, 29 Jul 2009 04:13:36 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1MW4I3-0003EV-0O; Wed, 29 Jul 2009 10:13:35 +0200 Subject: [PATCH] mac80211: disable beacons before removing the associated interface From: Johannes Berg To: John Linville Cc: linux-wireless , Bob Copeland Date: Wed, 29 Jul 2009 10:13:03 +0200 Message-Id: <1248855183.13742.16.camel@johannes.local> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Bob Copeland 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 Signed-off-by: Johannes Berg --- net/mac80211/iface.c | 10 ++++++++++ net/mac80211/main.c | 3 ++- net/mac80211/pm.c | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 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;