From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCCB8C282CE for ; Wed, 22 May 2019 19:54:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 97A7920856 for ; Wed, 22 May 2019 19:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558554889; bh=BPyaHdFdHRVysY+nekbwg00qYZ6CaFTtF+nA8OtWABU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=EV8SZomwDBBWeupW5BLEf+MNah13t2ooge2S5VZEawPiL+MPxXzb4by4yABTP9/JK Yw5K6Ynl6qUAruNTdOJmXiSWI2tLhHXjTbnIZdSq7o5EB5ckPDzQ01Qmndzg064Fhl 9S3uKe9IW7oQz79SiYxPgsNYmmx6i8pCf/4qystI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731674AbfEVTZi (ORCPT ); Wed, 22 May 2019 15:25:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:46946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731657AbfEVTZg (ORCPT ); Wed, 22 May 2019 15:25:36 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 76930217D9; Wed, 22 May 2019 19:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558553136; bh=BPyaHdFdHRVysY+nekbwg00qYZ6CaFTtF+nA8OtWABU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yjB1/ptzfJPKFL2r9EkcMXNbBdth2TisuxgRe5Zbz/7WsqohoMNr0hxiOe7o+syez J3EWDkp3y5u8H6oKYEtGpR9t5CmqZ6o+dLWy9Wjlh2OHxhElJQMgBlqBXVxXTQyfaA CIC/jciqGAoHs4MK8FpXnwlBD9Jt2bewPzMu0T0I= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sergey Matyukevich , Johannes Berg , Sasha Levin , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 066/317] mac80211/cfg80211: update bss channel on channel switch Date: Wed, 22 May 2019 15:19:27 -0400 Message-Id: <20190522192338.23715-66-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190522192338.23715-1-sashal@kernel.org> References: <20190522192338.23715-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sergey Matyukevich [ Upstream commit 5dc8cdce1d722c733f8c7af14c5fb595cfedbfa8 ] FullMAC STAs have no way to update bss channel after CSA channel switch completion. As a result, user-space tools may provide inconsistent channel info. For instance, consider the following two commands: $ sudo iw dev wlan0 link $ sudo iw dev wlan0 info The latter command gets channel info from the hardware, so most probably its output will be correct. However the former command gets channel info from scan cache, so its output will contain outdated channel info. In fact, current bss channel info will not be updated until the next [re-]connect. Note that mac80211 STAs have a workaround for this, but it requires access to internal cfg80211 data, see ieee80211_chswitch_work: /* XXX: shouldn't really modify cfg80211-owned data! */ ifmgd->associated->channel = sdata->csa_chandef.chan; This patch suggests to convert mac80211 workaround into cfg80211 behavior and to update current bss channel in cfg80211_ch_switch_notify. Signed-off-by: Sergey Matyukevich Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mlme.c | 3 --- net/wireless/nl80211.c | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 6878215672871..715ab0e6579cb 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1167,9 +1167,6 @@ static void ieee80211_chswitch_work(struct work_struct *work) goto out; } - /* XXX: shouldn't really modify cfg80211-owned data! */ - ifmgd->associated->channel = sdata->csa_chandef.chan; - ifmgd->csa_waiting_bcn = true; ieee80211_sta_reset_beacon_monitor(sdata); diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 156ce708b5330..0044bfb526abc 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -15667,6 +15667,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev, wdev->chandef = *chandef; wdev->preset_chandef = *chandef; + + if (wdev->iftype == NL80211_IFTYPE_STATION && + !WARN_ON(!wdev->current_bss)) + wdev->current_bss->pub.channel = chandef->chan; + nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, NL80211_CMD_CH_SWITCH_NOTIFY, 0); } -- 2.20.1