LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 11/92] mac80211/cfg80211: update bss channel on channel switch
Date: Wed, 22 May 2019 15:30:06 -0400	[thread overview]
Message-ID: <20190522193127.27079-11-sashal@kernel.org> (raw)
In-Reply-To: <20190522193127.27079-1-sashal@kernel.org>

From: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>

[ 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 <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 ed4fef32b394f..08384dbf426c8 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1104,9 +1104,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 81013490a99f4..1968998e6c6c2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -12788,6 +12788,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


  parent reply	other threads:[~2019-05-22 19:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-22 19:29 [PATCH AUTOSEL 4.4 01/92] gfs2: Fix lru_count going negative Sasha Levin
2019-05-22 19:29 ` [PATCH AUTOSEL 4.4 02/92] cxgb4: Fix error path in cxgb4_init_module Sasha Levin
2019-05-22 19:29 ` [PATCH AUTOSEL 4.4 03/92] mmc: core: Verify SD bus width Sasha Levin
2019-05-22 19:29 ` [PATCH AUTOSEL 4.4 04/92] powerpc/boot: Fix missing check of lseek() return value Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 05/92] ASoC: imx: fix fiq dependencies Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 06/92] spi: pxa2xx: fix SCR (divisor) calculation Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 07/92] brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler() Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 08/92] rtc: 88pm860x: prevent use-after-free on device remove Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 09/92] w1: fix the resume command API Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 10/92] dmaengine: pl330: _stop: clear interrupt status Sasha Levin
2019-05-22 19:30 ` Sasha Levin [this message]
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 12/92] driver core: platform: Fix the usage of platform device name(pdev->name) Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 13/92] ASoC: fsl_sai: Update is_slave_mode with correct value Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 14/92] mwifiex: prevent an array overflow Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 15/92] net: cw1200: fix a NULL pointer dereference Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 16/92] at76c50x-usb: Don't register led_trigger if usb_register_driver failed Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 17/92] ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 18/92] bcache: return error immediately in bch_journal_replay() Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 19/92] bcache: fix failure in journal relplay Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 20/92] bcache: add failure check to run_cache_set() for journal replay Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 21/92] bcache: avoid clang -Wunintialized warning Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 22/92] RDMA/cma: Consider scope_id while binding to ipv6 ll address Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 23/92] x86/build: Move _etext to actual end of .text Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 24/92] smpboot: Place the __percpu annotation correctly Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 25/92] x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault() Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 26/92] mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 27/92] HID: logitech-hidpp: use RAP instead of FAP to get the protocol version Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 28/92] pinctrl: pistachio: fix leaked of_node references Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 29/92] dmaengine: at_xdmac: remove BUG_ON macro in tasklet Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 30/92] media: coda: clear error return value before picture run Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 31/92] media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper Sasha Levin
2019-05-22 19:30 ` [PATCH AUTOSEL 4.4 32/92] media: au0828: stop video streaming only when last user stops Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190522193127.27079-11-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sergey.matyukevich.os@quantenna.com \
    --cc=stable@vger.kernel.org \
    --subject='Re: [PATCH AUTOSEL 4.4 11/92] mac80211/cfg80211: update bss channel on channel switch' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).