linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan.hovold@lundinova.se>
To: ath9k-devel@lists.ath9k.org, linux-wireless@vger.kernel.org
Cc: Johan Hovold <johan.hovold@lundinova.se>
Subject: [RFC][PATCH 1/2] ath9k: fix corrupt frames being forwarded to mac80211
Date: Tue, 20 Apr 2010 10:28:07 +0200	[thread overview]
Message-ID: <1271752088-13639-1-git-send-email-johan.hovold@lundinova.se> (raw)
In-Reply-To: <20100420082519.GB5288@lundinova.se>

Frame status frequently gets corrupted in hardware with 802.11n which
can lead to corrupt frames being forwarded to mac80211. This in turn may
trigger countermeasures in reponse to false MIC-errors or cause receive
to stall when frames are dropped after processing a frame with corrupt PN.

Verify frame status by making sure that no error flags are set if frame
is marked ok and that reserved bits 19 through 28 (0x1ff80000) are all
zero, otherwise discarded frame (as ATH9K_PHYERR_HT_CRC_ERROR).

Tested with AR9280 (WEP, TKIP and CCMP).

Signed-off-by: Johan Hovold <johan.hovold@lundinova.se>
---
 drivers/net/wireless/ath/ath9k/mac.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
index 4a2060e..2afe72f 100644
--- a/drivers/net/wireless/ath/ath9k/mac.c
+++ b/drivers/net/wireless/ath/ath9k/mac.c
@@ -934,9 +934,22 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
 			rs->rs_status |= ATH9K_RXERR_DECRYPT;
 		else if (ads.ds_rxstatus8 & AR_MichaelErr)
 			rs->rs_status |= ATH9K_RXERR_MIC;
+	} else {
+		if (ads.ds_rxstatus8 & (AR_CRCErr |
+					AR_PHYErr |
+					AR_DecryptCRCErr |
+					AR_MichaelErr |
+					AR_DecryptBusyErr))
+			goto corrupt;
 	}
+	if (ads.ds_rxstatus8 & 0x1ff80000)
+		goto corrupt;
 
 	return 0;
+corrupt:
+	rs->rs_status |= ATH9K_RXERR_PHY;
+	rs->rs_phyerr = ATH9K_PHYERR_HT_CRC_ERROR;
+	return 0;
 }
 EXPORT_SYMBOL(ath9k_hw_rxprocdesc);
 
-- 
1.7.0.3


  reply	other threads:[~2010-04-20  8:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-31 19:10 ath9k: receive stops working in AP-mode and 802.11n Johan Hovold
2010-04-16 10:48 ` ath9k: corrupt frames forwarded to mac80211 as decrypted (was: ath9k: receive stops working in AP-mode and 802.11n) Johan Hovold
2010-04-16 10:52   ` [RFC][PATCH 1/6] ath9k: clean up rx skb post-process logic Johan Hovold
2010-04-16 10:52   ` [RFC][PATCH 2/6] ath9k: do not mark frames with RXKEY_IX_INVALID as decrypted Johan Hovold
2010-04-16 11:32     ` [ath9k-devel] " Jouni Malinen
2010-04-20  8:35       ` Johan Hovold
2010-04-16 10:52   ` [RFC][PATCH 3/6] ath9k: do not mark frames with RX_DECRYPT_BUSY " Johan Hovold
2010-04-16 10:52   ` [RFC][PATCH 4/6] ath9k: do not mark frames with RX_KEY_MISS " Johan Hovold
2010-04-16 10:52   ` [RFC][PATCH 5/6] ath9k: check error flags even if rx frame is marked ok Johan Hovold
2010-04-16 10:52   ` [RFC][PATCH 6/6] ath9k: clear mic error flag on encrypted frames Johan Hovold
2010-04-20  8:25   ` [ath9k-devel] ath9k: corrupt frames forwarded to mac80211 as decrypted Johan Hovold
2010-04-20  8:28     ` Johan Hovold [this message]
2010-04-20  8:38       ` [RFC][PATCH 1/2] ath9k: fix corrupt frames being forwarded to mac80211 Johan Hovold
2010-04-20  8:28     ` [RFC][PATCH 2/2] ath9k: use also AR_DecryptBusyErr to determine decrypt errors Johan Hovold
2010-04-20  9:10     ` [ath9k-devel] ath9k: corrupt frames forwarded to mac80211 as decrypted Ranga Rao Ravuri
2010-04-20 11:06       ` Johan Hovold
2010-04-20 11:35         ` Johan Hovold
2010-04-29  8:26           ` Daniel Yingqiang Ma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271752088-13639-1-git-send-email-johan.hovold@lundinova.se \
    --to=johan.hovold@lundinova.se \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).