From adf2fef5e8665e534d4895308d9e3325df7716ba Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Fri, 13 Jan 2017 10:34:52 +0100 Subject: mac80211: backport some upstream fixes Backports the following upstream fixes: mac80211: initialize fast-xmit 'info' later mac80211: fix legacy and invalid rx-rate report mac80211: fix tid_agg_rx NULL dereference Compiled and tested on: cns3xxx Signed-off-by: Koen Vandeputte --- .../349-mac80211-fix-legacy-invalid-rxrate.patch | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch (limited to 'package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch') diff --git a/package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch b/package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch new file mode 100644 index 0000000000..c160515892 --- /dev/null +++ b/package/kernel/mac80211/patches/349-mac80211-fix-legacy-invalid-rxrate.patch @@ -0,0 +1,60 @@ +From a17d93ff3a950fefaea40e4a4bf3669b9137c533 Mon Sep 17 00:00:00 2001 +From: Ben Greear +Date: Wed, 14 Dec 2016 11:30:38 -0800 +Subject: [PATCH] mac80211: fix legacy and invalid rx-rate report + +This fixes obtaining the rate info via sta_set_sinfo +when the rx rate is invalid (for instance, on IBSS +interface that has received no frames from one of its +peers). + +Also initialize rinfo->flags for legacy rates, to not +rely on the whole sinfo being initialized to zero. + +Signed-off-by: Ben Greear +Signed-off-by: Johannes Berg +--- + net/mac80211/sta_info.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1975,6 +1975,7 @@ static void sta_stats_decode_rate(struct + u16 brate; + unsigned int shift; + ++ rinfo->flags = 0; + sband = local->hw.wiphy->bands[(rate >> 4) & 0xf]; + brate = sband->bitrates[rate & 0xf].bitrate; + if (rinfo->bw == RATE_INFO_BW_5) +@@ -1990,14 +1991,15 @@ static void sta_stats_decode_rate(struct + rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; + } + +-static void sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) ++static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) + { + u16 rate = ACCESS_ONCE(sta_get_last_rx_stats(sta)->last_rate); + + if (rate == STA_STATS_RATE_INVALID) +- rinfo->flags = 0; +- else +- sta_stats_decode_rate(sta->local, rate, rinfo); ++ return -EINVAL; ++ ++ sta_stats_decode_rate(sta->local, rate, rinfo); ++ return 0; + } + + static void sta_set_tidstats(struct sta_info *sta, +@@ -2202,8 +2204,8 @@ void sta_set_sinfo(struct sta_info *sta, + } + + if (!(sinfo->filled & BIT(NL80211_STA_INFO_RX_BITRATE))) { +- sta_set_rate_info_rx(sta, &sinfo->rxrate); +- sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); ++ if (sta_set_rate_info_rx(sta, &sinfo->rxrate) == 0) ++ sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); + } + + sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS); -- cgit v1.2.3