From patchwork Mon Dec 1 15:48:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5413241 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 4E7B79F1CD for ; Mon, 1 Dec 2014 15:49:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8667F20211 for ; Mon, 1 Dec 2014 15:48:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABD772025A for ; Mon, 1 Dec 2014 15:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932150AbaLAPs4 (ORCPT ); Mon, 1 Dec 2014 10:48:56 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:58061 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932147AbaLAPsz (ORCPT ); Mon, 1 Dec 2014 10:48:55 -0500 Received: by mail-wi0-f178.google.com with SMTP id hi2so17810458wib.5 for ; Mon, 01 Dec 2014 07:48:54 -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=kyitR0ZQcXSvVHCNo5WBlqbAhgARhEEyrfL2d70aSbU=; b=XpMb+F5ftJYWIqMg14YvE0Ey/4Y7Cr/UJ3NJnRX5i2OTi8W1vBv45ZpDYE59AiGNC9 sN0knAF2OFz89BNjTPUo6/PSDevmaockWfDp6VTUyU3w9HPnYXLWChD+CN4DayHiL6VQ ruJB+om6cTfxUJQ+YIMFDLCEAUweKeAFFl2ah4hbH0i/vQ3lnfMwF/0iHstQ3TNX0Uhv WqhHstXHq7kkhAKPAS4gqf/B1ZuD2KUR1sky7jcDyWA9w43OYAf1Xhm1N9No/Rmkd+f/ gXUucyno9ey1PSwgMZnRy/lizDVo3eoinQHtuBKLYPoeznLCw8+V6qUPTKidOLE1XDYJ lLYg== X-Gm-Message-State: ALoCoQmYOlCVAQnTzF/ZmAQEAdjdpqg93vbe2CaOc77zLtQQ61QmHOTlYlPEUck9Jrw0hhekDHj6 X-Received: by 10.194.190.19 with SMTP id gm19mr95249962wjc.51.1417448933906; Mon, 01 Dec 2014 07:48:53 -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 gf6sm15276047wjc.11.2014.12.01.07.48.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Dec 2014 07:48:53 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , "Luis R. Rodriguez" , Arik Nemtsov Subject: [PATCH v6 4/4] cfg80211: correctly check ad-hoc channels Date: Mon, 1 Dec 2014 17:48:47 +0200 Message-Id: <1417448927-9337-4-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417448927-9337-1-git-send-email-arik@wizery.com> References: <1417448927-9337-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 --- Ilan Peer mentioned this bug privately, so I thought I'd roll it up into this patch-set 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;