From patchwork Thu Aug 3 15:31:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Skeffington X-Patchwork-Id: 9879353 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 20957603B4 for ; Thu, 3 Aug 2017 15:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1155C28948 for ; Thu, 3 Aug 2017 15:31:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05FB92893B; Thu, 3 Aug 2017 15:31:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54E752893B for ; Thu, 3 Aug 2017 15:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751154AbdHCPbv (ORCPT ); Thu, 3 Aug 2017 11:31:51 -0400 Received: from mail-qk0-f178.google.com ([209.85.220.178]:36205 "EHLO mail-qk0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbdHCPbu (ORCPT ); Thu, 3 Aug 2017 11:31:50 -0400 Received: by mail-qk0-f178.google.com with SMTP id d136so9663390qkg.3 for ; Thu, 03 Aug 2017 08:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=astro-ai.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=FNY9vTD39nhTVJMrA2G/RrDewvHSweIfZyknTOwv60s=; b=YC9XyD55ueOS4NbeGMk3UJsD1WNE9DINbu8ulzVC4GPRGMAjVf5tXN6KYjYWcvysGI Z2vNqfxPs0vqj0bTtvcMlquOWrMBGJbsUZoYe3dJ1G8nxsT9yHzY6mNORPSEDS9j+JOM 0YsiIhNSXKZTqDdfVjFNqVO7b3ts93aR3bQDBICsC2Wqq2yjfBPcbFDX1mvvHZ7jq5Vk flRkdTl6TqP/Pet7+bnH1aktIKUFMaNT7mKbOx1A1oHzlS7pDxqAdhzHy8GwK47GT6TQ nmVS1YnV4kvjAhiHi+ks0UNILDcsgVqtvBUAUoNqkHdTrR30N1HMtsY0szpriJbmTfOe +JMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FNY9vTD39nhTVJMrA2G/RrDewvHSweIfZyknTOwv60s=; b=DTe0FYNNVr/wKiMQzwfjirocwSMeF+Lhk9vji4xY/HsQTi869O8bNTqKwZqf+d0bUJ +RM4oTt0DyR9O2WKIeYk+fkxxdSKssQqBfaysAd2yPFXEQScrpdxbfl0Lvoi4h9zXr3V M74425z9DjU36qdwbdVyR2IM5lZIcPtpXHLG6G+eP5dEsGrbwIOB7p1Vw9dPAjviVD/E Ph2s05AGyqJYBCDV5l2Yfhoe0fOmzjTqJSqa9+YYwBztDAkz7rHSfa3DN+yZTYhUqBAe zSniR5zKC7SqaxD0V6JE+L9lAJamXF5hIcQRxXQ+kAV/VNb6WKaeOvRZFeSyCKS1hD0H if+g== X-Gm-Message-State: AHYfb5hLjzu9S58rfxvS6+uPgVxwY6LtiDzLdZqRClpTU10lowh/Amol qhUw0/D/bg+MEPcL1SlVqQ== X-Received: by 10.55.47.135 with SMTP id v129mr3045319qkh.13.1501774309980; Thu, 03 Aug 2017 08:31:49 -0700 (PDT) Received: from SneakyWeasel.rga.com ([170.200.72.11]) by smtp.gmail.com with ESMTPSA id x125sm25095034qkc.87.2017.08.03.08.31.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2017 08:31:47 -0700 (PDT) From: Michael Skeffingfon To: Stanislaw Gruszka , Kalle Valo , Johannes Berg , linux-wireless@vger.kernel.org Cc: Michael Skeffington Subject: [PATCH v2] rt2x00: Fix MMIC Countermeasures. Date: Thu, 3 Aug 2017 11:31:21 -0400 Message-Id: <20170803153121.9046-1-mike@astro.ai> X-Mailer: git-send-email 2.11.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Skeffington 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 --- 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))