Commit fa4cffcb authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville

iwlegacy: fix IBSS cleanup

We do not correctly change interface type when switching from
IBSS mode to STA mode, that results in microcode errors.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=886946Reported-by: default avatarJaroslav Skarvada <jskarvad@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ead0ad16
...@@ -3958,17 +3958,21 @@ il_connection_init_rx_config(struct il_priv *il) ...@@ -3958,17 +3958,21 @@ il_connection_init_rx_config(struct il_priv *il)
memset(&il->staging, 0, sizeof(il->staging)); memset(&il->staging, 0, sizeof(il->staging));
if (!il->vif) { switch (il->iw_mode) {
case NL80211_IFTYPE_UNSPECIFIED:
il->staging.dev_type = RXON_DEV_TYPE_ESS; il->staging.dev_type = RXON_DEV_TYPE_ESS;
} else if (il->vif->type == NL80211_IFTYPE_STATION) { break;
case NL80211_IFTYPE_STATION:
il->staging.dev_type = RXON_DEV_TYPE_ESS; il->staging.dev_type = RXON_DEV_TYPE_ESS;
il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK; il->staging.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
} else if (il->vif->type == NL80211_IFTYPE_ADHOC) { break;
case NL80211_IFTYPE_ADHOC:
il->staging.dev_type = RXON_DEV_TYPE_IBSS; il->staging.dev_type = RXON_DEV_TYPE_IBSS;
il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK; il->staging.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
il->staging.filter_flags = il->staging.filter_flags =
RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK; RXON_FILTER_BCON_AWARE_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
} else { break;
default:
IL_ERR("Unsupported interface type %d\n", il->vif->type); IL_ERR("Unsupported interface type %d\n", il->vif->type);
return; return;
} }
...@@ -4550,8 +4554,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -4550,8 +4554,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
EXPORT_SYMBOL(il_mac_add_interface); EXPORT_SYMBOL(il_mac_add_interface);
static void static void
il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif)
bool mode_change)
{ {
lockdep_assert_held(&il->mutex); lockdep_assert_held(&il->mutex);
...@@ -4560,9 +4563,7 @@ il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif, ...@@ -4560,9 +4563,7 @@ il_teardown_interface(struct il_priv *il, struct ieee80211_vif *vif,
il_force_scan_end(il); il_force_scan_end(il);
} }
if (!mode_change) il_set_mode(il);
il_set_mode(il);
} }
void void
...@@ -4575,8 +4576,8 @@ il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) ...@@ -4575,8 +4576,8 @@ il_mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
WARN_ON(il->vif != vif); WARN_ON(il->vif != vif);
il->vif = NULL; il->vif = NULL;
il->iw_mode = NL80211_IFTYPE_UNSPECIFIED;
il_teardown_interface(il, vif, false); il_teardown_interface(il, vif);
memset(il->bssid, 0, ETH_ALEN); memset(il->bssid, 0, ETH_ALEN);
D_MAC80211("leave\n"); D_MAC80211("leave\n");
...@@ -4685,18 +4686,10 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, ...@@ -4685,18 +4686,10 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
} }
/* success */ /* success */
il_teardown_interface(il, vif, true);
vif->type = newtype; vif->type = newtype;
vif->p2p = false; vif->p2p = false;
err = il_set_mode(il); il->iw_mode = newtype;
WARN_ON(err); il_teardown_interface(il, vif);
/*
* We've switched internally, but submitting to the
* device may have failed for some reason. Mask this
* error, because otherwise mac80211 will not switch
* (and set the interface type back) and we'll be
* out of sync with it.
*/
err = 0; err = 0;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment