Received: by 10.213.65.68 with SMTP id h4csp1714309imn; Mon, 19 Mar 2018 11:14:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELvXuUBLYedRNYqIYSvXd5j4B33Xuoc38KGhcYq8vh5/H4n+aJw9hZu0NzAFeoLF7I67br0O X-Received: by 10.99.152.68 with SMTP id l4mr9610882pgo.75.1521483245421; Mon, 19 Mar 2018 11:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521483245; cv=none; d=google.com; s=arc-20160816; b=wj4M+67hbamGpD0VkkIblIPI9sUGgSPfQAeSz5TUXg7/RvsJLxSnWvuy2/dr0E5ecO z/TsJ8mbV/CEUxTCXkPAaQIAjggiLPlEZrCLyeIJRc3nFDVOCS6O1PwUgPg4upWL/1gy mcaxtQPHooh/UzGvT1sfdqZmBkF/dP1lCV2lFDCw30uwXr/EqVsCMQsa6xk4DQdWr8KO 0P1pwDAs8oTpgDBk5h2VpGWbsMLlihx5CMHrGz3RyFb4IaHh4+NzeWUwNv68s3mpODK0 QBTIUmprR1YSDxY2QYL4D9pEwxVWpdWxE5o8QYK1qpqCyfdegZrsIMkO5kPNYTBf12iz ck5w== 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=o7vJpD9hvA7ITLhmughb6R+PBUqxgRKpIQHydUxw2cM=; b=nHShy3cbDFuqiyywS5ivwHCKCFGpfxUHZ0jM5xjz5xV36n3S6mam7y2cScCqETgI2Q uQYvgn4BvcfNXmlsvwERYQCsJfLnM/DbAU/kDAYexX7bDGtjXujCPdmgsc6S47widRd3 wcSFZVYlWGPos+aIti2pfuLUTSxEjdtB6pL4A8BpGAXKT0OjYyCxo+52CPKv2fbN8Y1+ QwCAu1QrYfD8Iy5w30/4703dsA1cqRk+rfNjUeuQAC4x+PBhlG5O9PBxQ65n8VlWScwu z1+sIo4q30P1zauAx4/OJWrVyuOp2C2LXStsRJZyy93g5mo6fK3EN4KudMrVjuD3qxDk b5wQ== 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 w71si299314pgd.435.2018.03.19.11.13.50; Mon, 19 Mar 2018 11:14:05 -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 S935615AbeCSSMc (ORCPT + 99 others); Mon, 19 Mar 2018 14:12:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42772 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935568AbeCSSM1 (ORCPT ); Mon, 19 Mar 2018 14:12:27 -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 3C5901206; Mon, 19 Mar 2018 18:12:27 +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.4 017/134] ath10k: disallow DFS simulation if DFS channel is not enabled Date: Mon, 19 Mar 2018 19:05:00 +0100 Message-Id: <20180319171851.647428011@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@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.4-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 @@ -1892,6 +1892,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);