Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1460859pxb; Mon, 11 Oct 2021 06:33:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfrlZiWAmUBZquE7hZjSkizxkGXdmu3CC40kDQ/vFmcLj2wrDwJn2eQ6i8SqfR4XYbVuVY X-Received: by 2002:a17:906:b819:: with SMTP id dv25mr25846023ejb.21.1633959207795; Mon, 11 Oct 2021 06:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633959207; cv=none; d=google.com; s=arc-20160816; b=Z/sqfF1crRP2QlOXtrt9w1EseFWtRHPlYJPyWHgZGIbnzaMzA52Z1rTQxWqXCGQyip 0SQE+njqetdDipP4jhutubP14053Gqfx9WHG7WVzS+vnTxgsJjxiRkX+8p/ogz3+S6k5 AVAxhTvelsZ0z8qe5CkBE/RKJcmDZoq/etw01/Q5UM/V3QdMFQlyiOmtnLbRXO68sV8j wT6Gu/t/6yYsOMsCLsCo8mKqCSKamXiJeo53tqg+eeQyeatiRXu2XH+dATes5R165oEr zin7JZAwb+KVvw+tCDCidOyCRyifQWB1Zrmen/UkNQG1lzdlSOFvrlr30WioiLGN1rOo XzMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=CEp9SK2THAhiavjnyvyFXMvBhCVX42EpDIoO7m04Fuo=; b=SyULIap+yr+k7XYFTT+KR2lOAPy4iZ1Rd99ufR9e/CwcfPVamRluX2jJDtJGnfnaN+ v7FLuKS7k8wer/L3mAA0ty8bccfHJiKm+iv/vwN5nUJ3SyT3HudTHun8y0UruBiKAMlo n8VUGYDB3riXcMWz5/tbCbfd4ORbWOkRs8ocbckqFWdEPQ3704sLG9kWNIleUrVNVzFF mKLM6Yp4A3zAm9OTiFYe9lfxrh8BL3srSYW2kJUCxxcetuRQziZVy4/U5rI4XCLe2GQe zHMixe/I5+9NzxrMXWwDTwMtH7dg0TW3k0A2u7PbLexJaatdgCg1uwZqJXbE0tmVLhj+ tONw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=paSEsLdq; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 23si12524493ejg.540.2021.10.11.06.32.59; Mon, 11 Oct 2021 06:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=paSEsLdq; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235751AbhJKKMH (ORCPT + 76 others); Mon, 11 Oct 2021 06:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235712AbhJKKMG (ORCPT ); Mon, 11 Oct 2021 06:12:06 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD7FAC061570 for ; Mon, 11 Oct 2021 03:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject :To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CEp9SK2THAhiavjnyvyFXMvBhCVX42EpDIoO7m04Fuo=; b=paSEsLdqP962ly1Zvw/uCYX4US 70U2Xb0I1be/kTUtuMVgFu8aavkCqRPeGdlEkgZKwcj8AN0TDNARTX7SSlaAj/8WZGXcHLczMjGEg sOk8lugkN6OXIrEkvxNbM5mBOxmq2lbKJlbuV/IZTSO1E5zqftnAKRqj9preA5S2cf8U=; Received: from p4ff1322b.dip0.t-ipconnect.de ([79.241.50.43] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1mZsFw-0007uD-F3 for linux-wireless@vger.kernel.org; Mon, 11 Oct 2021 12:10:04 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH] mt76: do not access 802.11 header in ccmp check for 802.3 rx skbs Date: Mon, 11 Oct 2021 12:10:02 +0200 Message-Id: <20211011101002.53900-1-nbd@nbd.name> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Avoids false positive on detecting frags or encrypted mgmt frames Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mac80211.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index 5a6608f36ebc..766681a4f89e 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -974,6 +974,10 @@ mt76_check_ccmp_pn(struct sk_buff *skb) if (!wcid || !wcid->rx_check_pn) return 0; + security_idx = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK; + if (status->flag & RX_FLAG_8023) + goto skip_hdr_check; + hdr = mt76_skb_get_hdr(skb); if (!(status->flag & RX_FLAG_IV_STRIPPED)) { /* @@ -994,9 +998,8 @@ mt76_check_ccmp_pn(struct sk_buff *skb) if (ieee80211_is_mgmt(hdr->frame_control) && !ieee80211_has_tods(hdr->frame_control)) security_idx = IEEE80211_NUM_TIDS; - else - security_idx = status->qos_ctl & IEEE80211_QOS_CTL_TID_MASK; +skip_hdr_check: BUILD_BUG_ON(sizeof(status->iv) != sizeof(wcid->rx_key_pn[0])); ret = memcmp(status->iv, wcid->rx_key_pn[security_idx], sizeof(status->iv)); -- 2.30.1