Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6388006rwd; Mon, 19 Jun 2023 06:41:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ564uPKqsq8Mhhjy2nGhmsr0puAVXMs/R2u3j+1uYa4ycZ6s55ZqiCsse90ZWTb1YswMpLI X-Received: by 2002:a05:6a21:7882:b0:121:da9b:f689 with SMTP id bf2-20020a056a21788200b00121da9bf689mr3065551pzc.13.1687182061819; Mon, 19 Jun 2023 06:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687182061; cv=none; d=google.com; s=arc-20160816; b=LY3ruJeVaPfjAq0F/eUi5MA+FyDtz+t/QiZIQRTyVg/7JEnhfIRJo4vAgRyffI5R/4 5evTGJfe/ldkjcp7EkU/jJ1nGpquRQWl8uLsTsrU/tH9BpB9YW4avn79xJP/oWhw3C2a DOTXVgIc9iIr00Tx+0Tp57JiTZ67h7U+spgIwkXUgflzy5Wi/F5UXGAMD23IyUGOYM5w H1AXmNTGKEBpFB6O9ORbw3iRfMXXq7MjFq34lhguROiawqCVRsCard4ozqVVjm1Eavvw cXxVOIP6uIGwWGoi4gLzoYsUFySTnvKaEuYb7nDHS4Kdso42F5JXroTw94o/YES3HOnY NSZw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GkcU01rfWLaB2GQc6/mlR9OUcaRGDgC1m1OAhLMYoRU=; b=WOqkyHC1lScl4NF+LRMrkfxuQVPYfmwfDkvSF1YG5yyCJkbPI49Y6q+nGOTmRpkVtD 2Yir15/2U6auLTsnixJmpL9JUrOXX9A8+Kkh1dho7H7+gzaqTVs4oXa5WWcy6VrAWokB KcNoLz5D4MrSCxjSzUL7GDiengYCCcmFKpTYzg8PIZBLN5paMwgkmfGDTi2tVZ5ntps3 OW9GpCESDGEp51UxefKl5tYtKZjGTxo9L0BLn/xcP/mFWC2c2quD9tgitrzQxbFEMLlx iQY8keM6rXI2Up5d6p0bUVq1oDSurNRcAqA0vASYJcBxJe3Czov9Y+TNSW48UVguXIKM +D4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="oHE/QeIu"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j25-20020a635519000000b0054fb9698c4csi5358329pgb.13.2023.06.19.06.40.46; Mon, 19 Jun 2023 06:41:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="oHE/QeIu"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231911AbjFSN1M (ORCPT + 61 others); Mon, 19 Jun 2023 09:27:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229869AbjFSN1L (ORCPT ); Mon, 19 Jun 2023 09:27:11 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347C9127 for ; Mon, 19 Jun 2023 06:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687181230; x=1718717230; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kic8iWUAFicVvTvuOa0S3TWiqWH4AEXopDiJM+DfX2o=; b=oHE/QeIuIfB83a8VkbrwikVYf6QVUUO66fqfyq3m6u7nnKq7uxoW+hQ8 6ODObaTUjlmroqK/WOlQgtmtsuJnGcCzPHWKzKagYxNF3elfjE8ECCTIM 8wXz0ETVUxz1JO5sXF7tr+S80CxkixzzQ/Z+wqlqYhsAK3R6SB6WKYiIT levIkcjUp4rSmEAyz/8lVuhLM979N6lgJeXWg8Rg7LQWBdrNO4E+hvtWf qNRCEDTWLXRXXg8gJhY3iP4rdL/0RYdnEIcr1wh6ch8bpcOB/0lPeSlQI 8yRvQ+zgJUSl6sOXoZ93QHUYjT4O35xOL1DImV71+smMAYxMuCi4ONs+z g==; X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="339240653" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="339240653" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 06:27:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10746"; a="716871706" X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="716871706" Received: from aadawii-mobl2.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.214.201.44]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jun 2023 06:27:08 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Gregory Greenman Subject: [PATCH 2/9] wifi: mac80211: move action length check up Date: Mon, 19 Jun 2023 16:26:46 +0300 Message-Id: <20230619161906.e799254e923f.I0a1de5f6bbdc1b2ef5efaa0ac80c7c3f39415538@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230619132653.902084-1-gregory.greenman@intel.com> References: <20230619132653.902084-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Johannes Berg We'd like to add more checks to the function here for action frames, so move up the length check from the action processing. Signed-off-by: Johannes Berg Signed-off-by: Gregory Greenman --- net/mac80211/rx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index a2109d61487f..5c1d6c2674ef 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -3355,6 +3355,11 @@ ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx) if (!ieee80211_is_mgmt(mgmt->frame_control)) return RX_DROP_MONITOR; + /* drop too small action frames */ + if (ieee80211_is_action(mgmt->frame_control) && + rx->skb->len < IEEE80211_MIN_ACTION_SIZE) + return RX_DROP_UNUSABLE; + if (rx->sdata->vif.type == NL80211_IFTYPE_AP && ieee80211_is_beacon(mgmt->frame_control) && !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { @@ -3444,10 +3449,6 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) if (!ieee80211_is_action(mgmt->frame_control)) return RX_CONTINUE; - /* drop too small frames */ - if (len < IEEE80211_MIN_ACTION_SIZE) - return RX_DROP_UNUSABLE; - if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC && mgmt->u.action.category != WLAN_CATEGORY_SELF_PROTECTED && mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT) -- 2.38.1