From patchwork Wed Dec 3 16:08:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5432161 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 01C1BBEEA8 for ; Wed, 3 Dec 2014 16:16:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 376D220256 for ; Wed, 3 Dec 2014 16:16:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E8CC2012E for ; Wed, 3 Dec 2014 16:16:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753353AbaLCQQ3 (ORCPT ); Wed, 3 Dec 2014 11:16:29 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:34914 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752106AbaLCQIW (ORCPT ); Wed, 3 Dec 2014 11:08:22 -0500 Received: by mail-wi0-f173.google.com with SMTP id r20so31926177wiv.6 for ; Wed, 03 Dec 2014 08:08:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lIARFjfCKe8BWK+YAI8TjPAb/hWWb3L0uAieQXuIsPQ=; b=iJUbU8qi+YIke/QhM0eC729VLsjXiiX6sikUw0VcyhZVxXbgREiHLgckqkiL0J5hnC F9+vPEFeqC3ui6zAekz2Sw0KKLuGvHkxXwCcaFNW1VyR4dkefJ7DGd/R375bSqjIVw9O FfaPj8SI8CW4/Yrpt6cpnmEBF11fC4xX1D3h3k9qiG6Qsc3RsIpK9/uKvaEmiVjktOjk JzBZYlAzMO5PNc/XcJTHBfbVIFgTt9/83RIYYQWs9t+0sF0xX0HYJ99ip9d5rBob0ynX Nrcu0XXMqc3+0kjtnO+KP1spa1DKuYG8EHzJ/q/wJNhzfdG+LWcxDW78iKJpkm+4X+MC hvnw== X-Gm-Message-State: ALoCoQl9jKqsRJSCSzMXRpLPKaFe5ym1SJwkLeigP6mAoyZ8Zfxn8jtII7ucO0LXAeEr7pGgSggI X-Received: by 10.194.108.162 with SMTP id hl2mr8722988wjb.102.1417622900946; Wed, 03 Dec 2014 08:08:20 -0800 (PST) Received: from athena.amr.corp.intel.com (85-250-108-142.bb.netvision.net.il. [85.250.108.142]) by mx.google.com with ESMTPSA id p5sm565937wix.7.2014.12.03.08.08.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Dec 2014 08:08:20 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , "Luis R. Rodriguez" , Arik Nemtsov Subject: [PATCH v8 4/4] cfg80211: correctly check ad-hoc channels Date: Wed, 3 Dec 2014 18:08:17 +0200 Message-Id: <1417622897-30768-4-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417622897-30768-1-git-send-email-arik@wizery.com> References: <1417622897-30768-1-git-send-email-arik@wizery.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Ad-hoc requires beaconing for regulatory purposes. Validate that the channel is valid for beaconing, and not only enabled. Signed-off-by: Arik Nemtsov Reviewed-by: Luis R. Rodriguez --- net/wireless/reg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/wireless/reg.c b/net/wireless/reg.c index c3e6f80..004ea14 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -1552,9 +1552,15 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) ret = cfg80211_reg_can_beacon(wiphy, &wdev->chandef, wdev->iftype); break; + case NL80211_IFTYPE_ADHOC: + if (!wdev->ssid_len) + goto out; + + ret = cfg80211_reg_can_beacon(wiphy, + &wdev->chandef, wdev->iftype); + break; case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_ADHOC: if (!wdev->current_bss || !wdev->current_bss->pub.channel) goto out;