Received: by 10.223.185.116 with SMTP id b49csp1092870wrg; Sat, 3 Mar 2018 15:20:47 -0800 (PST) X-Google-Smtp-Source: AG47ELvHQ0NEGPnH8qB+KNynofWi7sJXHn4umAJ6EwNzGB+9hZPJNC8jE3Gw+CQ8Qgqc9JGyCLv8 X-Received: by 10.99.97.9 with SMTP id v9mr8250052pgb.373.1520119247829; Sat, 03 Mar 2018 15:20:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520119247; cv=none; d=google.com; s=arc-20160816; b=bfdQLjtYYcOX4L7gcuhvNoKzsTWhaQyZNb/uYqrcDEMC27wpaiNznezCJkfmpM95k4 VtueriqZLc2nJ+CL656n+Xyn/2yY7sJFA/To1ZVAys3gwIS1uoLgOElXqFLJDUOngxsC baSVQCvXAkvEGzXvqSssjTNSv5khXPYXz2BgwbMatB7cbQ6LJJJv0swszIrK2i3SXO/D cmQpQlSaKQE2BL3J+/uoGg7T7bd6qVTXXgAaXZJmLGJjyTvjxebWAyRXYOz9Pk991bUe 39QJIw7ZE0y8O6NiRyBuoL47ZQjfoISy1kvhVitZVX1Rh7PG2+o7/pMbDJ6eMNQ4GgB7 JQuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MCFnSrw8iZ//rN+Fsqp2qkjGqd5JZaGl8A0tDktCjMY=; b=ETuJrsejITieHpZXk/mJjc+SSsnkEcVtUuivle1dZlm1kQiOOmcAZnzZ/RR3H89GKI 5v4WvIMeMC5WEv4l+8MehCulvxqdDe2b0tUEk55ZV46DElyCZCC+7OjfVZ2tZcHGzzdR B8MYchlh4WrcUSqhfcGvSQv7fH/m94zsLlOAo6zJecvGoKoxwwFUWVh6aOgP7wqnLWxW ND2NqeOtv5WdRq4+F7isexZW73qfvCrSd58Xl5SKSrrQ/MJYBlyx+vhXUz9NpSWqLdWY lPvcnFYzrMDpksb6X2AlzKe9CKWSgsCzzW8kbuV54fLlQjz3WQbfBtG22dUa/K7sjf5p dklw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=kFty0hOd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si6144004pgr.617.2018.03.03.15.20.33; Sat, 03 Mar 2018 15:20:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=kFty0hOd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933145AbeCCXSt (ORCPT + 99 others); Sat, 3 Mar 2018 18:18:49 -0500 Received: from mail-cys01nam02on0114.outbound.protection.outlook.com ([104.47.37.114]:41081 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934750AbeCCWiH (ORCPT ); Sat, 3 Mar 2018 17:38:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MCFnSrw8iZ//rN+Fsqp2qkjGqd5JZaGl8A0tDktCjMY=; b=kFty0hOd1KLCh90z4T3LU/oMRcr9ewklWMZX3egh644PCLMKQwIqIayU+P0NXCttacvkGEo/v8lm+1CliFxiWc4IJvxfHuGWmuI3NL9CBFxiEOd89fkBzqOci3pZchJrAduQpqkGx+ehBNMHGSWm41npKBI7u8L1NANSmhl7sfY= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1067.namprd21.prod.outlook.com (52.132.149.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Sat, 3 Mar 2018 22:38:04 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:38:04 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Mohammed Shafi Shajakhan , Kalle Valo , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 017/115] ath10k: disallow DFS simulation if DFS channel is not enabled Thread-Topic: [PATCH AUTOSEL for 4.4 017/115] ath10k: disallow DFS simulation if DFS channel is not enabled Thread-Index: AQHTsz9MsbeA5/Pm/0qqe1WnT0bAtQ== Date: Sat, 3 Mar 2018 22:30:57 +0000 Message-ID: <20180303223010.27106-17-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1067;7:9Co5d8YCbCQGre6LgFXwjTDdm/xeyknw7Xic8kLEQk3EV+vvBup6+O57Wz/azNolcnjHNGZHdWFX8FYfUgoajKSz573wNZPR3xccyqr7QaUEoOvCg/PVmOlKZWfcTrUhg8/jxgiT2gN7vy9u1zHk1WTDK7vkwV542Ra91rCv0jfCIzea7jeVkkqOjrv3Qj4SYgUjPspCusLk3dM0EzXLt2H6PT6e4f2baWfmj2UOH/6BNUb9Og8WJK2CDxsS3doy x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0143a220-68d5-46d6-07d1-08d581576dc8 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1067; x-ms-traffictypediagnostic: MW2PR2101MB1067: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3231220)(944501244)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(6072148)(201708071742011);SRVR:MW2PR2101MB1067;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1067; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(39860400002)(39380400002)(346002)(199004)(189003)(51234002)(4326008)(5250100002)(86362001)(1076002)(2501003)(110136005)(6666003)(81156014)(2906002)(8936002)(305945005)(81166006)(2950100002)(7736002)(10290500003)(26005)(186003)(3660700001)(478600001)(72206003)(107886003)(8676002)(3280700002)(59450400001)(2900100001)(76176011)(6116002)(25786009)(3846002)(102836004)(575784001)(6506007)(5660300001)(97736004)(10090500001)(86612001)(106356001)(99286004)(6512007)(66066001)(316002)(53936002)(14454004)(105586002)(36756003)(6486002)(54906003)(6436002)(68736007)(22452003)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1067;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: MvzV1LWzH7z+aAsWb54thpX//sYo9NWg8NWCDlYg3hx9hqybgfKOC5vNY7qpAWYr1Mfrmh3bGfPa72NZdUhHDneOiiDzKnZSQaFy/ZEC2Pj4UIJDqwiS9Vhr8+qGCgX9Kcc4sP3+5+NVYB1Tv1n0ZOTzJZci0ph5vErmFdMuoME= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0143a220-68d5-46d6-07d1-08d581576dc8 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:30:57.3071 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1067 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mohammed Shafi Shajakhan [ Upstream commit ca07baab0b1e627ae1d4a55d190fb1c9d32a3445 ] If DFS is not enabled in hostapd (ieee80211h=3D0) DFS channels shall not be available for use even though the hardware may have the capability to support DFS. With this configuration (DFS disabled in hostapd) trying to bring up ath10k device in DFS channel for AP mode fails and trying to simulate DFS in ath10k debugfs results in a warning in cfg80211 complaining invalid channel and this should be avoided in the driver itself rather than false propogating RADAR detection to mac80211/cfg80211. Fix this by checking for the first vif 'is_started' state(should work for client mode as well) as all the vifs shall be configured for the same channel sys/kernel/debug/ieee80211/phy1/ath10k# echo 1 > dfs_simulate_radar WARNING: at net/wireless/chan.c:265 cfg80211_radar_event+0x24/0x60 Workqueue: phy0 ieee80211_dfs_radar_detected_work [mac80211] [] (warn_slowpath_null) from [] (cfg80211_radar_event+0x24/0x60 [cfg80211]) [] (cfg80211_radar_event [cfg80211]) from [] (ieee80211_dfs_radar_detected_work+0x94/0xa0 [mac80211]) [] (ieee80211_dfs_radar_detected_work [mac80211]) from [] (process_one_work+0x20c/0x32c) WARNING: at net/wireless/nl80211.c:2488 nl80211_get_mpath+0x13c/0x4cc Workqueue: phy0 ieee80211_dfs_radar_detected_work [mac80211] [] (warn_slowpath_null) from [] (cfg80211_radar_event+0x24/0x60 [cfg80211]) [] (cfg80211_radar_event [cfg80211]) from [] (ieee80211_dfs_radar_detected_work+0x94/0xa0 [mac80211]) [] (ieee80211_dfs_radar_detected_work [mac80211]) from [] (process_one_work+0x20c/0x32c) Signed-off-by: Mohammed Shafi Shajakhan Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath10k/debug.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless= /ath/ath10k/debug.c index 1a88a24ffeac..30c357567054 100644 --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -1892,6 +1892,15 @@ static ssize_t ath10k_write_simulate_radar(struct fi= le *file, size_t count, loff_t *ppos) { struct ath10k *ar =3D file->private_data; + struct ath10k_vif *arvif; + + /* Just check for for the first vif alone, as all the vifs will be + * sharing the same channel and if the channel is disabled, all the + * vifs will share the same 'is_started' state. + */ + arvif =3D list_first_entry(&ar->arvifs, typeof(*arvif), list); + if (!arvif->is_started) + return -EINVAL; =20 ieee80211_radar_detected(ar->hw); =20 --=20 2.14.1