cfg80211: fix disassoc while not associated
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 27 Jul 2009 08:22:28 +0000 (10:22 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 29 Jul 2009 19:46:11 +0000 (15:46 -0400)
When trying to disassociate while not associated,
the kernel would crash rather than refusing the
operation, fix this;

Reported-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/wireless/mlme.c

index 5b9b2212082496312d335cadd8cfceeae4cc8df7..30058a80d7af89d1e4e170c4c385d17dc553b559 100644 (file)
@@ -545,6 +545,12 @@ static int __cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
 
        ASSERT_WDEV_LOCK(wdev);
 
+       if (wdev->sme_state != CFG80211_SME_CONNECTED)
+               return -ENOTCONN;
+
+       if (WARN_ON(!wdev->current_bss))
+               return -ENOTCONN;
+
        memset(&req, 0, sizeof(req));
        req.reason_code = reason;
        req.ie = ie;