diff mbox

cfg80211: fix disassoc while not associated

Message ID 1248682948.19945.27.camel@johannes.local (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Johannes Berg July 27, 2009, 8:22 a.m. UTC
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>
---
 net/wireless/mlme.c |    6 ++++++
 1 file changed, 6 insertions(+)



--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Maxim Levitsky July 28, 2009, 7:53 p.m. UTC | #1
On Mon, 2009-07-27 at 10:22 +0200, Johannes Berg wrote:
> 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>
> ---
>  net/wireless/mlme.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> --- wireless-testing.orig/net/wireless/mlme.c	2009-07-27 10:20:17.000000000 +0200
> +++ wireless-testing/net/wireless/mlme.c	2009-07-27 10:20:56.000000000 +0200
> @@ -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;
> 
> 

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


Best regards,
	Maxim Levitsky

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- wireless-testing.orig/net/wireless/mlme.c	2009-07-27 10:20:17.000000000 +0200
+++ wireless-testing/net/wireless/mlme.c	2009-07-27 10:20:56.000000000 +0200
@@ -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;