From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Lindroth , Johannes Berg Subject: [PATCH 3.11 19/94] mac80211: fix crash if bitrate calculation goes wrong Date: Fri, 8 Nov 2013 22:51:25 -0800 Message-Id: <20131109065205.601348120@linuxfoundation.org> In-Reply-To: <20131109065204.252462489@linuxfoundation.org> References: <20131109065204.252462489@linuxfoundation.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johannes Berg 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 Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/mac80211/util.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -2155,6 +2155,10 @@ u64 ieee80211_calculate_rx_timestamp(str } 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)