]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iwlegacy: do not nulify il->vif on reset
authorStanislaw Gruszka <sgruszka@redhat.com>
Tue, 13 Mar 2012 15:11:27 +0000 (16:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2012 16:13:56 +0000 (09:13 -0700)
commit 883a649b737cdbe3ede7e50f3f939fd706ed5c4e upstream.

This il->vif is dereferenced in different part of iwlegacy code, so do
not nullify it. This should fix random crashes observed in companion
with microcode errors i.e. crash in il3945_config_ap().

Additionally this should address also
WARNING: at drivers/net/wireless/iwlegacy/common.c:4656 il_mac_remove_interface
at least one of the possible reasons of that warning.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/iwlegacy/3945-mac.c
drivers/net/wireless/iwlegacy/4965-mac.c
drivers/net/wireless/iwlegacy/common.c

index a7dfba8d164efb1eea0cc06b4de049220281e168..a2ec36911bd99616495f282ff89fe87ee9ce17c0 100644 (file)
@@ -2684,7 +2684,6 @@ il3945_bg_restart(struct work_struct *data)
 
        if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
                mutex_lock(&il->mutex);
-               il->ctx.vif = NULL;
                il->is_open = 0;
                mutex_unlock(&il->mutex);
                il3945_down(il);
index 1667232af647784e03d8bc15c9f63e44e9678990..b00712ccd9b3b84e0878a2444e90007088b13282 100644 (file)
@@ -5381,7 +5381,6 @@ il4965_bg_restart(struct work_struct *data)
 
        if (test_and_clear_bit(S_FW_ERROR, &il->status)) {
                mutex_lock(&il->mutex);
-               il->ctx.vif = NULL;
                il->is_open = 0;
 
                __il4965_down(il);
index 36454d0bbeedf7917b04e8d07f729e8b791f8a07..a608bc7ca33a49ad673e6c238d72c877a12678c3 100644 (file)
@@ -4575,6 +4575,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
        struct il_priv *il = hw->priv;
        struct il_vif_priv *vif_priv = (void *)vif->drv_priv;
        int err;
+       bool reset;
        u32 modes;
 
        D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr);
@@ -4594,6 +4595,16 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
                goto out;
        }
 
+       /*
+        * We do not support multiple virtual interfaces, but on hardware reset
+        * we have to add the same interface again.
+        */
+       reset = (il->ctx.vif == vif);
+       if (il->ctx.vif && !reset) {
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
        modes = il->ctx.interface_modes | il->ctx.exclusive_interface_modes;
        if (!(modes & BIT(vif->type))) {
                err = -EOPNOTSUPP;
@@ -4605,8 +4616,11 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 
        err = il_setup_interface(il, &il->ctx);
        if (err) {
-               il->ctx.vif = NULL;
-               il->iw_mode = NL80211_IFTYPE_STATION;
+               IL_WARN("Fail to set mode %d\n", vif->type);
+               if (!reset) {
+                       il->ctx.vif = NULL;
+                       il->iw_mode = NL80211_IFTYPE_STATION;
+               }
        }
 
 out: