wil6210: fix call to wil6210_disconnect during unload
authorLior David <liord@codeaurora.org>
Wed, 9 May 2018 10:06:54 +0000 (13:06 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 12 May 2018 09:27:03 +0000 (12:27 +0300)
Move the call to wil6210_disconnect so it will be called
before unregister_netdevice. This is because it calls
netif_carrier_off which is forbidden to call on an
unregistered net device. Calling netif_carrier_off can
add a link watch event which might be handled after
net device was freed, causing a kernel oops.

Signed-off-by: Lior David <liord@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/wil6210/netdev.c

index 05e9408e7ea39a0ac7fa077e213f3cf9b8e6b9d3..eb6c14ed65a417127a7a72b9347f91cb9f19ebbd 100644 (file)
@@ -457,16 +457,16 @@ void wil_vif_remove(struct wil6210_priv *wil, u8 mid)
                return;
        }
 
+       mutex_lock(&wil->mutex);
+       wil6210_disconnect(vif, NULL, WLAN_REASON_DEAUTH_LEAVING, false);
+       mutex_unlock(&wil->mutex);
+
        ndev = vif_to_ndev(vif);
        /* during unregister_netdevice cfg80211_leave may perform operations
         * such as stop AP, disconnect, so we only clear the VIF afterwards
         */
        unregister_netdevice(ndev);
 
-       mutex_lock(&wil->mutex);
-       wil6210_disconnect(vif, NULL, WLAN_REASON_DEAUTH_LEAVING, false);
-       mutex_unlock(&wil->mutex);
-
        if (any_active && vif->mid != 0)
                wmi_port_delete(wil, vif->mid);