Commit 2430816b authored by Johannes Berg's avatar Johannes Berg

cfg80211: fix interface down/disconnect state handling

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: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2b9ccd4e
...@@ -870,7 +870,6 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev, ...@@ -870,7 +870,6 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,
#endif #endif
__cfg80211_disconnect(rdev, dev, __cfg80211_disconnect(rdev, dev,
WLAN_REASON_DEAUTH_LEAVING, true); WLAN_REASON_DEAUTH_LEAVING, true);
cfg80211_mlme_down(rdev, dev);
wdev_unlock(wdev); wdev_unlock(wdev);
break; break;
case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_MESH_POINT:
......
...@@ -961,7 +961,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, ...@@ -961,7 +961,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
/* was it connected by userspace SME? */ /* was it connected by userspace SME? */
if (!wdev->conn) { if (!wdev->conn) {
cfg80211_mlme_down(rdev, dev); cfg80211_mlme_down(rdev, dev);
return 0; goto disconnect;
} }
if (wdev->sme_state == CFG80211_SME_CONNECTING && if (wdev->sme_state == CFG80211_SME_CONNECTING &&
...@@ -987,6 +987,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, ...@@ -987,6 +987,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
return err; return err;
} }
disconnect:
if (wdev->sme_state == CFG80211_SME_CONNECTED) if (wdev->sme_state == CFG80211_SME_CONNECTED)
__cfg80211_disconnected(dev, NULL, 0, 0, false); __cfg80211_disconnected(dev, NULL, 0, 0, false);
else if (wdev->sme_state == CFG80211_SME_CONNECTING) else if (wdev->sme_state == CFG80211_SME_CONNECTING)
......
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