]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/mac80211-cfg80211-update-bss-channel-on-channel-swit.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / mac80211-cfg80211-update-bss-channel-on-channel-swit.patch
CommitLineData
1143c684
SL
1From 6c17d17476b84f747c1ebb81fc922a5f8c10e966 Mon Sep 17 00:00:00 2001
2From: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
3Date: Tue, 26 Mar 2019 09:27:37 +0000
4Subject: mac80211/cfg80211: update bss channel on channel switch
5
6[ Upstream commit 5dc8cdce1d722c733f8c7af14c5fb595cfedbfa8 ]
7
8FullMAC STAs have no way to update bss channel after CSA channel switch
9completion. As a result, user-space tools may provide inconsistent
10channel info. For instance, consider the following two commands:
11$ sudo iw dev wlan0 link
12$ sudo iw dev wlan0 info
13The latter command gets channel info from the hardware, so most probably
14its output will be correct. However the former command gets channel info
15from scan cache, so its output will contain outdated channel info.
16In fact, current bss channel info will not be updated until the
17next [re-]connect.
18
19Note that mac80211 STAs have a workaround for this, but it requires
20access to internal cfg80211 data, see ieee80211_chswitch_work:
21
22 /* XXX: shouldn't really modify cfg80211-owned data! */
23 ifmgd->associated->channel = sdata->csa_chandef.chan;
24
25This patch suggests to convert mac80211 workaround into cfg80211 behavior
26and to update current bss channel in cfg80211_ch_switch_notify.
27
28Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
29Signed-off-by: Johannes Berg <johannes.berg@intel.com>
30Signed-off-by: Sasha Levin <sashal@kernel.org>
31---
32 net/mac80211/mlme.c | 3 ---
33 net/wireless/nl80211.c | 5 +++++
34 2 files changed, 5 insertions(+), 3 deletions(-)
35
36diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
37index ed4fef32b394f..08384dbf426c8 100644
38--- a/net/mac80211/mlme.c
39+++ b/net/mac80211/mlme.c
40@@ -1104,9 +1104,6 @@ static void ieee80211_chswitch_work(struct work_struct *work)
41 goto out;
42 }
43
44- /* XXX: shouldn't really modify cfg80211-owned data! */
45- ifmgd->associated->channel = sdata->csa_chandef.chan;
46-
47 ifmgd->csa_waiting_bcn = true;
48
49 ieee80211_sta_reset_beacon_monitor(sdata);
50diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
51index 81013490a99f4..1968998e6c6c2 100644
52--- a/net/wireless/nl80211.c
53+++ b/net/wireless/nl80211.c
54@@ -12788,6 +12788,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
55
56 wdev->chandef = *chandef;
57 wdev->preset_chandef = *chandef;
58+
59+ if (wdev->iftype == NL80211_IFTYPE_STATION &&
60+ !WARN_ON(!wdev->current_bss))
61+ wdev->current_bss->pub.channel = chandef->chan;
62+
63 nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL,
64 NL80211_CMD_CH_SWITCH_NOTIFY, 0);
65 }
66--
672.20.1
68