Commit dee8a973 authored by Johannes Berg's avatar Johannes Berg

cfg80211: don't request disconnect if not connected

Neil Brown reports that with libertas, my recent cfg80211
SME changes in commit ceca7b71
("cfg80211: separate internal SME implementation") broke
libertas suspend because it we now asked it to disconnect
while already disconnected.

The problematic change is in cfg80211_disconnect() as it
previously checked the SME state and now calls the driver
disconnect operation unconditionally.

Fix this by checking if there's a current_bss indicating
a connection, and do nothing if not.
Reported-and-tested-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent cb35fba3
...@@ -976,21 +976,19 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev, ...@@ -976,21 +976,19 @@ int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
struct net_device *dev, u16 reason, bool wextev) struct net_device *dev, u16 reason, bool wextev)
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
int err; int err = 0;
ASSERT_WDEV_LOCK(wdev); ASSERT_WDEV_LOCK(wdev);
kfree(wdev->connect_keys); kfree(wdev->connect_keys);
wdev->connect_keys = NULL; wdev->connect_keys = NULL;
if (wdev->conn) { if (wdev->conn)
err = cfg80211_sme_disconnect(wdev, reason); err = cfg80211_sme_disconnect(wdev, reason);
} else if (!rdev->ops->disconnect) { else if (!rdev->ops->disconnect)
cfg80211_mlme_down(rdev, dev); cfg80211_mlme_down(rdev, dev);
err = 0; else if (wdev->current_bss)
} else {
err = rdev_disconnect(rdev, dev, reason); err = rdev_disconnect(rdev, dev, reason);
}
return err; return err;
} }
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