From patchwork Thu Oct 18 04:49:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sujith Manoharan X-Patchwork-Id: 1608251 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 770373FC1A for ; Thu, 18 Oct 2012 04:55:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751888Ab2JREzl (ORCPT ); Thu, 18 Oct 2012 00:55:41 -0400 Received: from sabertooth02.qualcomm.com ([65.197.215.38]:44551 "EHLO sabertooth02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197Ab2JREzl (ORCPT ); Thu, 18 Oct 2012 00:55:41 -0400 X-Greylist: delayed 367 seconds by postgrey-1.27 at vger.kernel.org; Thu, 18 Oct 2012 00:55:41 EDT X-IronPort-AV: E=McAfee;i="5400,1158,6868"; a="576380" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by sabertooth02.qualcomm.com with ESMTP; 17 Oct 2012 21:28:15 -0700 X-IronPort-AV: E=Sophos;i="4.80,604,1344236400"; d="scan'208";a="353297376" Received: from nasanexhc04.na.qualcomm.com ([172.30.48.17]) by Ironmsg03-R.qualcomm.com with ESMTP/TLS/RC4-SHA; 17 Oct 2012 21:49:32 -0700 Received: from APHYDEXHC05.ap.qualcomm.com (172.30.48.1) by nasanexhc04.na.qualcomm.com (172.30.48.17) with Microsoft SMTP Server (TLS) id 14.2.318.1; Wed, 17 Oct 2012 21:49:32 -0700 Received: from nako (10.100.2.99) by qcmail1.qualcomm.com (10.222.117.51) with Microsoft SMTP Server (TLS) id 14.2.318.1; Thu, 18 Oct 2012 10:19:30 +0530 From: Sujith Manoharan MIME-Version: 1.0 Message-ID: <20607.35416.907913.623637@gargle.gargle.HOWL> Date: Thu, 18 Oct 2012 10:19:28 +0530 To: X-Mailer: VM 8.2.0b under 24.2.1 (x86_64-unknown-linux-gnu) CC: Subject: [PATCH] cfg80211: Disallow HT/WEP in IBSS mode X-Originating-IP: [10.100.2.99] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Currently, a user is allowed to choose a HT operating channel with WEP when creating an IBSS network. WEP is not allowed in HT configuration - this patch ensures that such requests are denied. Signed-off-by: Sujith Manoharan --- net/wireless/nl80211.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0418a6d..e1255e9 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -690,7 +690,7 @@ static int nl80211_parse_key(struct genl_info *info, struct key_parse *k) static struct cfg80211_cached_keys * nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, - struct nlattr *keys) + struct nlattr *keys, bool *no_ht) { struct key_parse parse; struct nlattr *key; @@ -733,6 +733,12 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, result->params[parse.idx].key_len = parse.p.key_len; result->params[parse.idx].key = result->data[parse.idx]; memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len); + + if (result->params[parse.idx].cipher == WLAN_CIPHER_SUITE_WEP40 || + result->params[parse.idx].cipher == WLAN_CIPHER_SUITE_WEP104) { + if (no_ht) + *no_ht = true; + } } return result; @@ -5339,10 +5345,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) return -EINVAL; if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) { + bool no_ht = false; + connkeys = nl80211_parse_connkeys(rdev, - info->attrs[NL80211_ATTR_KEYS]); + info->attrs[NL80211_ATTR_KEYS], + &no_ht); if (IS_ERR(connkeys)) return PTR_ERR(connkeys); + + if ((ibss.channel_type != NL80211_CHAN_NO_HT) && no_ht) { + kfree(connkeys); + return -EINVAL; + } } ibss.control_port = @@ -5642,7 +5656,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { connkeys = nl80211_parse_connkeys(rdev, - info->attrs[NL80211_ATTR_KEYS]); + info->attrs[NL80211_ATTR_KEYS], NULL); if (IS_ERR(connkeys)) return PTR_ERR(connkeys); }