3cfb91a
If channel switch is pending and we remove interface we can
3cfb91a
crash like showed below due to passing NULL vif to mac80211:
3cfb91a
3cfb91a
BUG: unable to handle kernel paging request at fffffffffffff8cc
3cfb91a
IP: [<ffffffff8130924d>] strnlen+0xd/0x40
3cfb91a
Call Trace:
3cfb91a
 [<ffffffff8130ad2e>] string.isra.3+0x3e/0xd0
3cfb91a
 [<ffffffff8130bf99>] vsnprintf+0x219/0x640
3cfb91a
 [<ffffffff8130c481>] vscnprintf+0x11/0x30
3cfb91a
 [<ffffffff81061585>] vprintk_emit+0x115/0x4f0
3cfb91a
 [<ffffffff81657bd5>] printk+0x61/0x63
3cfb91a
 [<ffffffffa048987f>] ieee80211_chswitch_done+0xaf/0xd0 [mac80211]
3cfb91a
 [<ffffffffa04e7b34>] iwl_chswitch_done+0x34/0x40 [iwldvm]
3cfb91a
 [<ffffffffa04f83c3>] iwlagn_commit_rxon+0x2a3/0xdc0 [iwldvm]
3cfb91a
 [<ffffffffa04ebc50>] ? iwlagn_set_rxon_chain+0x180/0x2c0 [iwldvm]
3cfb91a
 [<ffffffffa04e5e76>] iwl_set_mode+0x36/0x40 [iwldvm]
3cfb91a
 [<ffffffffa04e5f0d>] iwlagn_mac_remove_interface+0x8d/0x1b0 [iwldvm]
3cfb91a
 [<ffffffffa0459b3d>] ieee80211_do_stop+0x29d/0x7f0 [mac80211]
3cfb91a
3cfb91a
This is because we nulify ctx->vif in iwlagn_mac_remove_interface()
3cfb91a
before calling some other functions that teardown interface. To fix
3cfb91a
just check ctx->vif on iwl_chswitch_done(). We should not call
3cfb91a
ieee80211_chswitch_done() as channel switch works were already canceled
3cfb91a
by mac80211 in ieee80211_do_stop() -> ieee80211_mgd_stop().
3cfb91a
3cfb91a
Resolve:
3cfb91a
https://bugzilla.redhat.com/show_bug.cgi?id=979581
3cfb91a
3cfb91a
Cc: stable@vger.kernel.org
3cfb91a
Reported-by: Lukasz Jagiello <jagiello.lukasz@gmail.com>
3cfb91a
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
3cfb91a
---
3cfb91a
 drivers/net/wireless/iwlwifi/dvm/mac80211.c | 5 ++++-
3cfb91a
 1 file changed, 4 insertions(+), 1 deletion(-)
3cfb91a
3cfb91a
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
3cfb91a
index 323e4a3..9a817df 100644
3cfb91a
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
3cfb91a
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
3cfb91a
@@ -1046,7 +1046,10 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
3cfb91a
 	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
3cfb91a
 		return;
3cfb91a
 
3cfb91a
-	if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
3cfb91a
+	if (!test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
3cfb91a
+		return;
3cfb91a
+
3cfb91a
+	if (ctx->vif)
3cfb91a
 		ieee80211_chswitch_done(ctx->vif, is_success);
3cfb91a
 }
3cfb91a
 
3cfb91a
-- 
3cfb91a
1.7.11.7
3cfb91a
3cfb91a
--
3cfb91a
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
3cfb91a
the body of a message to majordomo@vger.kernel.org
3cfb91a
More majordomo info at  http://vger.kernel.org/majordomo-info.html