aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-10-11 09:47:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-12 22:05:30 -0500
commit0b1621f62382e9b6f97b35861e9ade1a979b95b8 (patch)
tree91019d05487eb7c058b6b0dacd25ba5c44f11ea0 /net
parent31da12cec6d7882acb2bd968566b1cfbbcae695a (diff)
mac80211: fix crash if bitrate calculation goes wrong
commit d86aa4f8ca58898ec6a94c0635da20b948171ed7 upstream. If a frame's timestamp is calculated, and the bitrate calculation goes wrong and returns zero, the system will attempt to divide by zero and crash. Catch this case and print the rate information that the driver reported when this happens. Reported-by: Thomas Lindroth <thomas.lindroth@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 72e6292955bb..5db8eb5d56cf 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2174,6 +2174,10 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
2174 } 2174 }
2175 2175
2176 rate = cfg80211_calculate_bitrate(&ri); 2176 rate = cfg80211_calculate_bitrate(&ri);
2177 if (WARN_ONCE(!rate,
2178 "Invalid bitrate: flags=0x%x, idx=%d, vht_nss=%d\n",
2179 status->flag, status->rate_idx, status->vht_nss))
2180 return 0;
2177 2181
2178 /* rewind from end of MPDU */ 2182 /* rewind from end of MPDU */
2179 if (status->flag & RX_FLAG_MACTIME_END) 2183 if (status->flag & RX_FLAG_MACTIME_END)