Skip to contentSkip to conversation

cfg80211: fix disassoc while not associated

PATCH In review Johannes Berg 2 participants 2 messages Jul 27, 2009 – Jul 28, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 cfg80211: fix disassoc while not associated

When trying to disassociate while not associated,
the kernel would crash rather than refusing the
operation, fix this;

---
 net/wireless/mlme.c |    6 ++++++
 1 file changed, 6 insertions(+)
net/wireless/mlme.c +6 -0
@@ -545,6 +545,12 @@ static int __cfg80211_mlme_disassoc(stru
 
 	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;
#1 lore raw
Quoted 17 lines · Johannes Berg

When trying to disassociate while not associated,
the kernel would crash rather than refusing the
operation, fix this;

---
 net/wireless/mlme.c |    6 ++++++
 1 file changed, 6 insertions(+)
net/wireless/mlme.c +0 -0
@@ -545,6 +545,12 @@ static int __cfg80211_mlme_disassoc(stru
 
 	ASSERT_WDEV_LOCK(wdev);

net/wireless/mlme.c static int __cfg80211_mlme_disassoc(stru · line 556

Quoted 10 lines
net/wireless/mlme.c +6 -0
 
+	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;

Thanks, this fixes this bug for me.
Still many problems though.

Best regards,
Maxim Levitsky