diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-10-11 15:47:06 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-13 12:08:07 +0900 |
commit | 94579b022349f6e2c991a94154d09af81591f2c4 (patch) | |
tree | 463c31ff65c83906e31c4b3df2f3329ab173a865 | |
parent | 0be5e3842206b504deb190e8c325bf775a2b4c48 (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>
-rw-r--r-- | net/mac80211/util.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 22654452a56..31e78ae59cb 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2155,6 +2155,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) |