From patchwork Mon Jul 27 08:22:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 37453 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6R8MaTQ022418 for ; Mon, 27 Jul 2009 08:22:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754771AbZG0IWd (ORCPT ); Mon, 27 Jul 2009 04:22:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753463AbZG0IWd (ORCPT ); Mon, 27 Jul 2009 04:22:33 -0400 Received: from xc.sipsolutions.net ([83.246.72.84]:56384 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754651AbZG0IWd (ORCPT ); Mon, 27 Jul 2009 04:22:33 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1MVLTX-0002LD-Cy; Mon, 27 Jul 2009 10:22:28 +0200 Subject: [PATCH] cfg80211: fix disassoc while not associated From: Johannes Berg To: John Linville Cc: Maxim Levitsky , linux-wireless Date: Mon, 27 Jul 2009 10:22:28 +0200 Message-Id: <1248682948.19945.27.camel@johannes.local> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When trying to disassociate while not associated, the kernel would crash rather than refusing the operation, fix this; Reported-by: Maxim Levitsky Signed-off-by: Johannes Berg --- 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 --- 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;