2011-07-06 09:06:39 +00:00
|
|
|
--- a/drivers/net/wireless/ath/ath9k/recv.c
|
|
|
|
+++ b/drivers/net/wireless/ath/ath9k/recv.c
|
2011-07-09 03:33:59 +00:00
|
|
|
@@ -814,16 +814,19 @@ static bool ath9k_rx_accept(struct ath_c
|
2011-07-06 09:06:39 +00:00
|
|
|
struct ath_rx_status *rx_stats,
|
|
|
|
bool *decrypt_error)
|
|
|
|
{
|
|
|
|
-#define is_mc_or_valid_tkip_keyix ((is_mc || \
|
|
|
|
- (rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID && \
|
|
|
|
- test_bit(rx_stats->rs_keyix, common->tkip_keymap))))
|
|
|
|
-
|
2011-07-09 03:33:59 +00:00
|
|
|
+ bool is_mc, is_valid_tkip, strip_mic, mic_error = false;
|
2011-07-06 09:06:39 +00:00
|
|
|
struct ath_hw *ah = common->ah;
|
|
|
|
__le16 fc;
|
|
|
|
u8 rx_status_len = ah->caps.rx_status_len;
|
|
|
|
|
|
|
|
fc = hdr->frame_control;
|
|
|
|
|
|
|
|
+ is_mc = !!is_multicast_ether_addr(hdr->addr1);
|
|
|
|
+ is_valid_tkip = rx_stats->rs_keyix != ATH9K_RXKEYIX_INVALID &&
|
|
|
|
+ test_bit(rx_stats->rs_keyix, common->tkip_keymap);
|
2011-07-09 03:33:59 +00:00
|
|
|
+ strip_mic = is_valid_tkip && !(rx_stats->rs_status &
|
|
|
|
+ (ATH9K_RXERR_DECRYPT | ATH9K_RXERR_CRC | ATH9K_RXERR_MIC));
|
2011-07-06 09:06:39 +00:00
|
|
|
+
|
|
|
|
if (!rx_stats->rs_datalen)
|
|
|
|
return false;
|
|
|
|
/*
|
2011-07-13 15:37:36 +00:00
|
|
|
@@ -838,6 +841,11 @@ static bool ath9k_rx_accept(struct ath_c
|
|
|
|
if (rx_stats->rs_more)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
+ mic_error = is_valid_tkip && !ieee80211_is_ctl(fc) &&
|
|
|
|
+ !ieee80211_has_morefrags(fc) &&
|
|
|
|
+ !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) &&
|
|
|
|
+ (rx_stats->rs_status & ATH9K_RXERR_MIC);
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* The rx_stats->rs_status will not be set until the end of the
|
|
|
|
* chained descriptors so it can be ignored if rs_more is set. The
|
|
|
|
@@ -845,30 +853,18 @@ static bool ath9k_rx_accept(struct ath_c
|
|
|
|
* descriptors.
|
|
|
|
*/
|
|
|
|
if (rx_stats->rs_status != 0) {
|
|
|
|
- if (rx_stats->rs_status & ATH9K_RXERR_CRC)
|
|
|
|
+ if (rx_stats->rs_status & ATH9K_RXERR_CRC) {
|
|
|
|
rxs->flag |= RX_FLAG_FAILED_FCS_CRC;
|
|
|
|
+ mic_error = false;
|
|
|
|
+ }
|
2011-07-09 03:33:59 +00:00
|
|
|
if (rx_stats->rs_status & ATH9K_RXERR_PHY)
|
|
|
|
return false;
|
|
|
|
|
2011-07-13 15:37:36 +00:00
|
|
|
if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) {
|
2011-07-06 09:06:39 +00:00
|
|
|
*decrypt_error = true;
|
2011-07-09 03:33:59 +00:00
|
|
|
- } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) {
|
2011-07-06 09:06:39 +00:00
|
|
|
- bool is_mc;
|
2011-07-09 03:33:59 +00:00
|
|
|
- /*
|
|
|
|
- * The MIC error bit is only valid if the frame
|
|
|
|
- * is not a control frame or fragment, and it was
|
2011-07-06 09:06:39 +00:00
|
|
|
- * decrypted using a valid TKIP key.
|
2011-07-09 03:33:59 +00:00
|
|
|
- */
|
2011-07-06 09:06:39 +00:00
|
|
|
- is_mc = !!is_multicast_ether_addr(hdr->addr1);
|
2011-07-13 15:37:36 +00:00
|
|
|
-
|
2011-07-09 03:33:59 +00:00
|
|
|
- if (!ieee80211_is_ctl(fc) &&
|
|
|
|
- !ieee80211_has_morefrags(fc) &&
|
|
|
|
- !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) &&
|
2011-07-06 09:06:39 +00:00
|
|
|
- is_mc_or_valid_tkip_keyix)
|
|
|
|
- rxs->flag |= RX_FLAG_MMIC_ERROR;
|
2011-07-09 03:33:59 +00:00
|
|
|
- else
|
|
|
|
- rx_stats->rs_status &= ~ATH9K_RXERR_MIC;
|
2011-07-13 15:37:36 +00:00
|
|
|
+ mic_error = false;
|
|
|
|
}
|
|
|
|
+
|
2011-07-09 03:33:59 +00:00
|
|
|
/*
|
|
|
|
* Reject error frames with the exception of
|
|
|
|
* decryption and MIC failures. For monitor mode,
|
2011-07-13 15:37:36 +00:00
|
|
|
@@ -886,6 +882,18 @@ static bool ath9k_rx_accept(struct ath_c
|
2011-07-06 09:06:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * For unicast frames the MIC error bit can have false positives,
|
|
|
|
+ * so all MIC error reports need to be validated in software.
|
|
|
|
+ * False negatives are not common, so skip software verification
|
|
|
|
+ * if the hardware considers the MIC valid.
|
|
|
|
+ */
|
2011-07-09 03:33:59 +00:00
|
|
|
+ if (strip_mic)
|
2011-07-06 09:06:39 +00:00
|
|
|
+ rxs->flag |= RX_FLAG_MMIC_STRIPPED;
|
2011-07-09 03:33:59 +00:00
|
|
|
+ else if (is_mc && mic_error)
|
2011-07-06 09:06:39 +00:00
|
|
|
+ rxs->flag |= RX_FLAG_MMIC_ERROR;
|
2011-07-09 03:33:59 +00:00
|
|
|
+
|
2011-07-06 09:06:39 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-07-13 15:37:36 +00:00
|
|
|
@@ -1940,6 +1948,9 @@ int ath_rx_tasklet(struct ath_softc *sc,
|
2011-07-12 03:24:53 +00:00
|
|
|
sc->rx.rxotherant = 0;
|
|
|
|
}
|
2011-07-09 03:33:59 +00:00
|
|
|
|
|
|
|
+ if (rxs->flag & RX_FLAG_MMIC_STRIPPED)
|
|
|
|
+ skb_trim(skb, skb->len - 8);
|
|
|
|
+
|
2011-07-12 03:24:53 +00:00
|
|
|
spin_lock_irqsave(&sc->sc_pm_lock, flags);
|
|
|
|
|
|
|
|
if ((sc->ps_flags & (PS_WAIT_FOR_BEACON |
|