cfg80211: fix interface down/disconnect state handling
authorJohannes Berg <johannes.berg@intel.com>
Tue, 14 May 2013 07:19:53 +0000 (09:19 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 16 May 2013 20:38:08 +0000 (22:38 +0200)
When the interface goes down, there's no need to call
cfg80211_mlme_down() after __cfg80211_disconnect() as
the latter will call the former (if appropriate.)

Also, in __cfg80211_disconnect(), if the cfg80211 SME
isn't used, __cfg80211_disconnected() may still need
to be called (depending on the current state) so that
the SME state gets cleared.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c
net/wireless/sme.c

index 6c9f8005cac095bdff948ff4a75f286cbac039e9..73405e00c800fd62ff703c9c030e31da70c69858 100644 (file)
@@ -870,7 +870,6 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,
 #endif
                __cfg80211_disconnect(rdev, dev,
                                      WLAN_REASON_DEAUTH_LEAVING, true);
-               cfg80211_mlme_down(rdev, dev);
                wdev_unlock(wdev);
                break;
        case NL80211_IFTYPE_MESH_POINT:
index a9dc5c736df061466463e01bb890fed8f28e5389..8b5eddfba1e5dfed07b1fb528204c125db2d7331 100644 (file)
@@ -961,7 +961,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
                /* was it connected by userspace SME? */
                if (!wdev->conn) {
                        cfg80211_mlme_down(rdev, dev);
-                       return 0;
+                       goto disconnect;
                }
 
                if (wdev->sme_state == CFG80211_SME_CONNECTING &&
@@ -987,6 +987,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
                        return err;
        }
 
+ disconnect:
        if (wdev->sme_state == CFG80211_SME_CONNECTED)
                __cfg80211_disconnected(dev, NULL, 0, 0, false);
        else if (wdev->sme_state == CFG80211_SME_CONNECTING)