Received: by 10.213.65.68 with SMTP id h4csp1775121imn; Mon, 19 Mar 2018 12:57:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELtVd6e+Blo3f8H10wJ/DxEZwUU0vaXWwG2gx6bG0H+dpLAhCCRC8EAK9MRr+qov5Tkq5+Dx X-Received: by 10.98.15.137 with SMTP id 9mr11274765pfp.216.1521489421063; Mon, 19 Mar 2018 12:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521489421; cv=none; d=google.com; s=arc-20160816; b=rhDYUJnfcBk/vS6zJ+Iu6rmvnraGfNcKYy3UvEOZ74VxsB+z/Tnay3pZZwxoPQEm/N 1+gtY7rRelJg1jrJFwyDv09XtiorAU9S78Hle/y7BF91hmOBJd+c5/blFJ7DRDdn4aYX EuLiqrTv64fvvwq0V+0okJ4XBNfuMzmXAM4RdS+5kvtkIf9Srss5N0Ezqfc1WI/skLnb 3Xl1WCp+6tw3gQWAI43rQ5GeZdPJ09NXVd1cAec5o8Xee+Cdnp/SAIOV0kmf4zTP+JyO aM+7ZrqpYgeoEEBWS8cND+L2m+O3HiJmn/+YdXBSQbh+QuizG8K3WqybmIVsmMJXdGgO 4LUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1ABMJiQjoJ6tkk1dVAP957GSK31vp2T67ZQ/+naoLTs=; b=c7uDnhXKknnAnHbbhmu4hq0PYKSYA462I9J+B/3DlJABEipKPft9M2jyLG3AioEo6R ePLPMmYm9lbQC7a8LjB5DI6/mXj1CLbOVtgWFhc8kqLuWuJlD1Nbn4R0/5axwk/SN1h7 HVywemcjHOjp1NFKgYmYqA+06kKvF3Fwm3IKkV3Nscz7s8cf+8GSqQno/pJYhODuxtZ/ 13CfQ1du9gT3IHunbAdVhg9j/uVGI5o34x5JW4+XOAlESg4B0PZIwtSdADJF01iNbWw5 2sDrl5kABWbsBwvgw0dYAgcrwoq18IZRx2awg/VbiQd8AfvgpG1l0s+tRBHHZKWbOhX6 Sd2Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16-v6si484098pli.557.2018.03.19.12.56.45; Mon, 19 Mar 2018 12:57:01 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969398AbeCSST0 (ORCPT + 99 others); Mon, 19 Mar 2018 14:19:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46918 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969377AbeCSSTR (ORCPT ); Mon, 19 Mar 2018 14:19:17 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C0BDB10F6; Mon, 19 Mar 2018 18:19:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohammed Shafi Shajakhan , Kalle Valo , Sasha Levin Subject: [PATCH 4.9 033/241] ath10k: disallow DFS simulation if DFS channel is not enabled Date: Mon, 19 Mar 2018 19:04:58 +0100 Message-Id: <20180319180752.550931639@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mohammed Shafi Shajakhan [ Upstream commit ca07baab0b1e627ae1d4a55d190fb1c9d32a3445 ] If DFS is not enabled in hostapd (ieee80211h=0) 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 Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/ath/ath10k/debug.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/net/wireless/ath/ath10k/debug.c +++ b/drivers/net/wireless/ath/ath10k/debug.c @@ -1942,6 +1942,15 @@ static ssize_t ath10k_write_simulate_rad size_t count, loff_t *ppos) { struct ath10k *ar = 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 = list_first_entry(&ar->arvifs, typeof(*arvif), list); + if (!arvif->is_started) + return -EINVAL; ieee80211_radar_detected(ar->hw);