Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp660858ybb; Wed, 1 Apr 2020 07:28:06 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvtfIq7AyGBvIGg9B/v0OLgnNMv2AMn/BWpw7P7N1H97tB3Zuq/MFb8DE5QDbIOZ5aLc5ju X-Received: by 2002:a9d:600b:: with SMTP id h11mr16302345otj.210.1585751286019; Wed, 01 Apr 2020 07:28:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585751286; cv=none; d=google.com; s=arc-20160816; b=Dki6dxPpLhN/tU7bvlSWh4EGKQreeLB5nj7WEILbAFHVO3PL9MI2zU1vcMqlNPUAd7 uDfKLL5ceO9zDeyR5UnEf4saSvu+vMFF/GtzNfb7GFNZ70DHKfkwjxYbciXajsuQcUTO DVTZ8tIWlCjWdCHj0Ql1Vbixg7nX5xCDXu16C/bhbIh2Mp3I8oRumlUkh/CwEriW2Tik GbA45h1vbhQqoPIHzSs/veHd8oSoPL2CQ9aumofp9QhzXXanD1J+hIF64R9x1Xh+btCu 3IBxesPIywNWlOfTxoW6whzW71th/pDrUsuiOLYhA25MywZhWuy17BFuIY6mEeWOlLpZ 3hsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature; bh=hKmDSFnt4XlbDcKZk9ygMnOt+kN/ht1bsWx8zI+R9QY=; b=MnIRAYR5qgvbQGM/CQAVVHPFbATMknJ7TMbOyR2RJhDTQHTGGYWdS/QjLLfcKTMJ6o kGuk4hDNZo0HiQne3GFJUAJE2puKyG8gKo0+2s6lFmmxTQMOuK6pCd/mDiI7CGdrlaau UKV/TuuMdmDige4PiU5TkEWs50QCdchLYXJc2fijcLWmMQm83kGFQT7A5D3QWzDYKxLQ btP9UVSUPUUQicwdU7PsHr+mL0vaEpEbERktje2Mx2dHISpbEQliPNCh5N4UTo8bfAUc +mT1QfWjWGJnKxU1ykVa3kr84pHmj2MROJf2qDTc7quJof0tZAgVvFLyRFAGI7zk1KAa ovPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=X5FiJwJi; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1si860649otr.302.2020.04.01.07.27.37; Wed, 01 Apr 2020 07:28:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=X5FiJwJi; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732906AbgDAO1F (ORCPT + 99 others); Wed, 1 Apr 2020 10:27:05 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:33009 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732749AbgDAO1E (ORCPT ); Wed, 1 Apr 2020 10:27:04 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1585751224; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=hKmDSFnt4XlbDcKZk9ygMnOt+kN/ht1bsWx8zI+R9QY=; b=X5FiJwJi+EF/R43C+TSarnsLbq2nU1vuhbXfW9RP9hHeWrS8lS/nr7a188cndmdFRZmYWlFU 854R8rIx9uQAgx6zbdvulRUEBvYzFhdg26HvZGKlIH+Aby2Ry9+e7Q93578z2dYE2FsWY8FV TjSGqb8n3vkOHXtjnceJxzb0YG4= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e84a4b1.7f5dbd645d18-smtp-out-n03; Wed, 01 Apr 2020 14:26:57 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id EF797C433D2; Wed, 1 Apr 2020 14:26:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from jouni.codeaurora.org (37-130-184-238.bb.dnainternet.fi [37.130.184.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jouni) by smtp.codeaurora.org (Postfix) with ESMTPSA id E67A5C433BA; Wed, 1 Apr 2020 14:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E67A5C433BA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jouni@codeaurora.org From: Jouni Malinen To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Jouni Malinen Subject: [PATCH 2/2] mac80211: Report beacon protection failures to user space Date: Wed, 1 Apr 2020 17:25:48 +0300 Message-Id: <20200401142548.6990-2-jouni@codeaurora.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200401142548.6990-1-jouni@codeaurora.org> References: <20200401142548.6990-1-jouni@codeaurora.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Report received Beacon frames that do not have a valid MME MIC when beacon protection is enabled. This covers both the cases of no MME in the received frame and invalid MIC in the MME. Signed-off-by: Jouni Malinen --- net/mac80211/rx.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 91a13aee4378..a724551b8ddf 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1984,8 +1984,12 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) if (mmie_keyidx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS || mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS + - NUM_DEFAULT_BEACON_KEYS) + NUM_DEFAULT_BEACON_KEYS) { + cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev, + skb->data, + skb->len); return RX_DROP_MONITOR; /* unexpected BIP keyidx */ + } rx->key = ieee80211_rx_get_bigtk(rx, mmie_keyidx); if (!rx->key) @@ -2131,6 +2135,10 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) /* either the frame has been decrypted or will be dropped */ status->flag |= RX_FLAG_DECRYPTED; + if (unlikely(ieee80211_is_beacon(fc) && result == RX_DROP_UNUSABLE)) + cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev, + skb->data, skb->len); + return result; } @@ -2411,8 +2419,12 @@ static int ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx) return -EACCES; } if (unlikely(ieee80211_is_beacon(fc) && rx->key && - ieee80211_get_mmie_keyidx(rx->skb) < 0)) + ieee80211_get_mmie_keyidx(rx->skb) < 0)) { + cfg80211_rx_unprot_mlme_mgmt(rx->sdata->dev, + rx->skb->data, + rx->skb->len); return -EACCES; + } /* * When using MFP, Action frames are not allowed prior to * having configured keys. -- 2.20.1