Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2440903rwd; Wed, 14 Jun 2023 02:55:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BMsdJFnSuElPxMeaEjV4pMPM+paKBMsAfeE+y5LDrwkIZP9V7UmJBIqWkvq2o0gTDVEWL X-Received: by 2002:a05:6a00:ac2:b0:63d:3339:e967 with SMTP id c2-20020a056a000ac200b0063d3339e967mr1147078pfl.19.1686736538842; Wed, 14 Jun 2023 02:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686736538; cv=none; d=google.com; s=arc-20160816; b=LDQ5We/jiHG2//ba4j6ULCxzKNIgMhmDPlGzUYB+Bp5GC9Bn2Znx79nm+EjV40aMZA ab7jL5Aj+04fx0svA9Mkk3zsWlOqYk1KfTBnL914+Ts/nk1hQ6vxWjijPTGazCHpVNHM yE85Qy2+Y6DA5JFlIYMji4GiYggo6EqTpGpQ18JHJvNFNqk3GCpHxofL/DFWwYLWi0sY 3VqYWbaKqnVgGpxwVRrU28G61r61MmY2nErrwyHWJuZzzlhmaiTrV3mo11Fo0ub7GvgW lR1ycjUZfxnNnLX7QTiuZwXj8uzXfC1m5+HQ4YuRqxjbjR88ELLdhn+Yk7ZRXYUG+L+b l7Gw== 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=oHO8muwsexEKru1ccY72NFp3lFdqXjzZsBHiz4i1xSY=; b=PRj8S+AiFH7MH2eYhLEmW05RGOuxgQG2H3wYoqDFF78rVZh3LF5h5GvdDBR48z7fFh a3rtN1IKx6nl+ewhnyBNwgI3H8cYV5Ms6tl+FgBrLbBflZ4dj4DtPG8RQMIv0RY9Zsaj Gmqi7y7ufEHPd4RXuZ/9Pzx+21Ma/funyCk1ijr6V5I8Br09t2Xj2Xm7xjWTEYFIIzmz Egn9ZbDmWjwnYuw5oRBmdDnS90W9bR0otVVCl7+RWATtTbRc5TmD5yYwVxBNJSiiMNpW 0OQitov6Qf1K+tEqbdKKW4/h1e8Z/j58JSDJeBEwNFEKEdJHUm9Lqm8FLwWfO5/SISMX rkNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Sl1PO//j"; 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 g16-20020aa79dd0000000b0064e1b65f01dsi15568pfq.237.2023.06.14.02.55.31; Wed, 14 Jun 2023 02:55:38 -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="Sl1PO//j"; 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 S244285AbjFNJp5 (ORCPT + 61 others); Wed, 14 Jun 2023 05:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244329AbjFNJow (ORCPT ); Wed, 14 Jun 2023 05:44:52 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8682718 for ; Wed, 14 Jun 2023 02:43:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686735838; x=1718271838; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nhvN+EHxnhNwPjf53yuSu39kH5ShuTGUixrptlcxMuA=; b=Sl1PO//jCbvmWmes2dxXKjnMBVcggUIwrHM+QKVOg9TmgWnqBOan4GxK hVdn4I5KUhSNlPyygVAwH5R8szn/iu+UbvpufdILyPVufvhSHj1wsO0qe b2DcrTNeqQRxAa0b2J8Uu7IcbHGyhO5XuhULPfdgiymIdOLCcV4pE0M+E sCckT5uFRb9tS0im4Un3jvxW8royf7+NC/Tb4iNtcDTvo01Bj/bR7n8Lc rPQtj4lRSP4CGgeo3dHXBmqywTR74xeTauvngn1G+F4XuFkx05Ugxpvx7 LR3qvVVyJQTAjVFosUEHe817O5SEYdnedH+ZvXKAtrN4H6j2T56CbZqcW A==; X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="361049920" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="361049920" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 02:42:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10740"; a="711989913" X-IronPort-AV: E=Sophos;i="6.00,242,1681196400"; d="scan'208";a="711989913" Received: from basharil-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.lan) ([10.214.203.45]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 02:42:33 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Anjaneyulu , Gregory Greenman Subject: [PATCH 18/20] wifi: iwlwifi: mvm: Validate tid is in valid range before using it Date: Wed, 14 Jun 2023 12:41:35 +0300 Message-Id: <20230614123447.cea75e1f57e7.I03bc0a81d2c1bdbf4784c12c4c62b8538892ccba@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230614094137.379897-1-gregory.greenman@intel.com> References: <20230614094137.379897-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: Anjaneyulu Validate tid is less then MAX TID when it is used to access corresponding arrays. Signed-off-by: Anjaneyulu Signed-off-by: Gregory Greenman --- drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 10 +++++++--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c index b38b24246675..542c192698a4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rx.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* - * Copyright (C) 2012-2014, 2018-2022 Intel Corporation + * Copyright (C) 2012-2014, 2018-2023 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */ @@ -213,8 +213,12 @@ static void iwl_mvm_rx_handle_tcm(struct iwl_mvm *mvm, }; u16 thr; - if (ieee80211_is_data_qos(hdr->frame_control)) - ac = tid_to_mac80211_ac[ieee80211_get_tid(hdr)]; + if (ieee80211_is_data_qos(hdr->frame_control)) { + u8 tid = ieee80211_get_tid(hdr); + + if (tid < IWL_MAX_TID_COUNT) + ac = tid_to_mac80211_ac[tid]; + } mvmsta = iwl_mvm_sta_from_mac80211(sta); mac = mvmsta->mac_id_n_color & FW_CTXT_ID_MSK; diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c index 5c06839b87c2..9dbe71d299ae 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c @@ -484,7 +484,7 @@ static void iwl_mvm_rx_csum(struct iwl_mvm *mvm, } /* - * returns true if a packet is a duplicate and should be dropped. + * returns true if a packet is a duplicate or invalid tid and should be dropped. * Updates AMSDU PN tracking info */ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue, @@ -513,11 +513,14 @@ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue, return false; } - if (ieee80211_is_data_qos(hdr->frame_control)) + if (ieee80211_is_data_qos(hdr->frame_control)) { /* frame has qos control */ tid = ieee80211_get_tid(hdr); - else + if (tid >= IWL_MAX_TID_COUNT) + return true; + } else { tid = IWL_MAX_TID_COUNT; + } /* If this wasn't a part of an A-MSDU the sub-frame index will be 0 */ sub_frame_idx = desc->amsdu_info & -- 2.38.1