From patchwork Mon Dec 1 16:28:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5413971 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE2D99F1C5 for ; Mon, 1 Dec 2014 16:29:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7BE020218 for ; Mon, 1 Dec 2014 16:29:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DC7A20120 for ; Mon, 1 Dec 2014 16:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752895AbaLAQ3B (ORCPT ); Mon, 1 Dec 2014 11:29:01 -0500 Received: from mail-wg0-f53.google.com ([74.125.82.53]:48256 "EHLO mail-wg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753359AbaLAQ27 (ORCPT ); Mon, 1 Dec 2014 11:28:59 -0500 Received: by mail-wg0-f53.google.com with SMTP id l18so14625180wgh.40 for ; Mon, 01 Dec 2014 08:28:58 -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=h/lVO81n8XbVme174fYOoLTQuIUkzxMucvf8iSCSYmqOH6eUskQXairZrQDAy7osjB mUNrPVH87N9iYmkGu63SP2EU0NFDpcjgUDDhATwl932R0tBEQv5vYaDoVTtJ/gznfACz 25H24kwtKB9oURnU7PGHgnJIzmBydBAwTh/2K9ghqVEHYeKmwoOwTdoepTvAssEF+O7C Nk+AaWAz1H5uAehB3/yDSss2rAKtO8504YHC/xcd68BDeMcAVh/1D+lSmMJ/0riI7eho 5aibHvw756292nuT0MRqzIIzc8pbwkUfe+abFjYDNRx8E9ENlQHJvGHXFCzk/tnIpeyI s9Xw== X-Gm-Message-State: ALoCoQlJEuIj6FrncMGPsndIhJZ5DheHRVwv8nIlTvBrSylWJ3YhuCxssvGrQ/m7qwjxy4FRzVlY X-Received: by 10.194.5.227 with SMTP id v3mr97134450wjv.63.1417451338278; Mon, 01 Dec 2014 08:28:58 -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 ud1sm28239342wjc.7.2014.12.01.08.28.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Dec 2014 08:28:57 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , "Luis R. Rodriguez" , Arik Nemtsov Subject: [PATCH v7 4/4] cfg80211: correctly check ad-hoc channels Date: Mon, 1 Dec 2014 18:28:51 +0200 Message-Id: <1417451331-20536-4-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417451331-20536-1-git-send-email-arik@wizery.com> References: <1417451331-20536-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;