summaryrefslogtreecommitdiff
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2013-10-11 13:47:06 (GMT)
committerJohannes Berg <johannes.berg@intel.com>2013-10-14 07:47:08 (GMT)
commitd86aa4f8ca58898ec6a94c0635da20b948171ed7 (patch)
tree9f6ca03c0304f1b5fe9f2b1cb4e5cf1b1d9e0a53 /net/mac80211
parentf5563318ff1bde15b10e736e97ffce13be08bc1a (diff)
downloadlinux-fsl-qoriq-d86aa4f8ca58898ec6a94c0635da20b948171ed7.tar.xz
mac80211: fix crash if bitrate calculation goes wrong
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. Cc: stable@vger.kernel.org Reported-by: Thomas Lindroth <thomas.lindroth@gmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-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 9c3200b..69e4ef5 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -2238,6 +2238,10 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
}
rate = cfg80211_calculate_bitrate(&ri);
+ if (WARN_ONCE(!rate,
+ "Invalid bitrate: flags=0x%x, idx=%d, vht_nss=%d\n",
+ status->flag, status->rate_idx, status->vht_nss))
+ return 0;
/* rewind from end of MPDU */
if (status->flag & RX_FLAG_MACTIME_END)