linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rt2x00: Fix MMIC Countermeasures.
@ 2017-08-03 15:31 Michael Skeffingfon
  2017-08-04  6:23 ` Kalle Valo
  2017-08-07  6:31 ` Stanislaw Gruszka
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Skeffingfon @ 2017-08-03 15:31 UTC (permalink / raw)
  To: Stanislaw Gruszka, Kalle Valo, Johannes Berg, linux-wireless
  Cc: Michael Skeffington

From: Michael Skeffington <mike@astro.ai>

Set RX_FLAG_DECRYPTED in case of MMIC failure so that ieee80211_rx_h_decrypt() doesnt drop the frame before getting to ieee80211_rx_h_michael_mic_verify().

Signed-off-by: Michael Skeffington <mike@astro.ai>

---
 drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 13 +++++++++++--
 drivers/net/wireless/ralink/rt2x00/rt2800usb.c  | 15 ++++++++++++---
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
index ee5276e233fa..ace91a2db756 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
@@ -136,10 +136,19 @@ void rt2800mmio_fill_rxdone(struct queue_entry *entry,
 		 */
 		rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
 
-		if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
+		if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
 			rxdesc->flags |= RX_FLAG_DECRYPTED;
-		else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
+        } else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {
+			/*
+			 * In order to check the Michael Mic, the packet must have
+			 * been decrypted.  Mac80211 doesnt check the MMIC failure 
+			 * flag to initiate MMIC countermeasures if the decoded flag
+			 * has not been set.
+			 */
+			rxdesc->flags |= RX_FLAG_DECRYPTED;
+
 			rxdesc->flags |= RX_FLAG_MMIC_ERROR;
+        }
 	}
 
 	if (rt2x00_get_field32(word, RXD_W3_MY_BSS))
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index 685b8e0cd67d..7e5f397c37f9 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -697,11 +697,20 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry,
 		 * stripped it from the frame. Signal this to mac80211.
 		 */
 		rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
-
-		if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
+        
+		if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
+			rxdesc->flags |= RX_FLAG_DECRYPTED;
+        } else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {
+			/*
+			 * In order to check the Michael Mic, the packet must have
+			 * been decrypted.  Mac80211 doesnt check the MMIC failure 
+			 * flag to initiate MMIC countermeasures if the decoded flag
+			 * has not been set.
+			 */
 			rxdesc->flags |= RX_FLAG_DECRYPTED;
-		else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
+
 			rxdesc->flags |= RX_FLAG_MMIC_ERROR;
+        }
 	}
 
 	if (rt2x00_get_field32(word, RXD_W0_MY_BSS))
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] rt2x00: Fix MMIC Countermeasures.
  2017-08-03 15:31 [PATCH v2] rt2x00: Fix MMIC Countermeasures Michael Skeffingfon
@ 2017-08-04  6:23 ` Kalle Valo
  2017-08-07  6:31 ` Stanislaw Gruszka
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2017-08-04  6:23 UTC (permalink / raw)
  To: Michael Skeffingfon; +Cc: Stanislaw Gruszka, Johannes Berg, linux-wireless

Michael Skeffingfon <mike@astro.ai> writes:

> From: Michael Skeffington <mike@astro.ai>
>
> Set RX_FLAG_DECRYPTED in case of MMIC failure so that ieee80211_rx_h_decrypt() doesnt drop the frame before getting to ieee80211_rx_h_michael_mic_verify().
>
> Signed-off-by: Michael Skeffington <mike@astro.ai>

The commit log is not wrapped to 72 characters per line and the period
is not preferred in the title. But I can fix those.


-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] rt2x00: Fix MMIC Countermeasures.
  2017-08-03 15:31 [PATCH v2] rt2x00: Fix MMIC Countermeasures Michael Skeffingfon
  2017-08-04  6:23 ` Kalle Valo
@ 2017-08-07  6:31 ` Stanislaw Gruszka
  2017-08-07 16:57   ` Michael Skeffington
  1 sibling, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2017-08-07  6:31 UTC (permalink / raw)
  To: Michael Skeffingfon; +Cc: Kalle Valo, Johannes Berg, linux-wireless

On Thu, Aug 03, 2017 at 11:31:21AM -0400, Michael Skeffingfon wrote:
> @@ -136,10 +136,19 @@ void rt2800mmio_fill_rxdone(struct queue_entry *entry,
>  		 */
>  		rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
>  
> -		if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
> +		if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
>  			rxdesc->flags |= RX_FLAG_DECRYPTED;
> -		else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
> +        } else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {

Not sure why this happened, but here and on some other places below,
tab was replaced by spaces resulting in wrong indent.

Stanislaw

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] rt2x00: Fix MMIC Countermeasures.
  2017-08-07  6:31 ` Stanislaw Gruszka
@ 2017-08-07 16:57   ` Michael Skeffington
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Skeffington @ 2017-08-07 16:57 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: Kalle Valo, Johannes Berg, linux-wireless

Sorry about that, I work on other projects that use spaces and I must have
missed that when double checking the patch.  I sent out a new patch with
the correct line length, removal of trailing '.' and indentation fix.

On Mon, Aug 7, 2017 at 2:31 AM, Stanislaw Gruszka <sgruszka@redhat.com> wrote:
> On Thu, Aug 03, 2017 at 11:31:21AM -0400, Michael Skeffingfon wrote:
>> @@ -136,10 +136,19 @@ void rt2800mmio_fill_rxdone(struct queue_entry *entry,
>>                */
>>               rxdesc->flags |= RX_FLAG_MMIC_STRIPPED;
>>
>> -             if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS)
>> +             if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) {
>>                       rxdesc->flags |= RX_FLAG_DECRYPTED;
>> -             else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC)
>> +        } else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) {
>
> Not sure why this happened, but here and on some other places below,
> tab was replaced by spaces resulting in wrong indent.
>
> Stanislaw

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-07 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 15:31 [PATCH v2] rt2x00: Fix MMIC Countermeasures Michael Skeffingfon
2017-08-04  6:23 ` Kalle Valo
2017-08-07  6:31 ` Stanislaw Gruszka
2017-08-07 16:57   ` Michael Skeffington

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).