Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2988960rwb; Fri, 2 Dec 2022 19:26:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5TXFKPfTGDAmYT16DbqTFWaY55jf81G533Rdq9g54QkBYWYYhpTrHYd7PrRYpPBpiH9rDZ X-Received: by 2002:a63:165d:0:b0:473:f7cd:6603 with SMTP id 29-20020a63165d000000b00473f7cd6603mr48300222pgw.336.1670037994898; Fri, 02 Dec 2022 19:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670037994; cv=none; d=google.com; s=arc-20160816; b=eJadth+u/8SAfHnywVHDZcTkPDHT8W+k2pLU7U6+LKbIu9rIPTC4iUxqwuS3T0knRO T+9FHz5Ez8dDANYMwIuYerg2TnzXo1ydEib7sc6msRji1ajZWKdgA+7C8zZ+jMh9yPl3 JuhQCUk9SqXcKIamDnHjHyBrQQZdkWZwKgb+QRfgx6kFPlLYQqu6rECoc0sDNIQpqGF/ kapGzLY+23iYcHwCsXX6ISDgrm3xbFk7mkfL+6RCLGrmmXkHP20XxaNedb8k15gORaMI DzGgHj+bsr1aPcBiLs0mISuKUsTsuDuXpVsNeRYzRLeKvAwjizr+7ukD9cLdd5Jc7nuu VkGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qxn7s+B8JwIhyxqEztH5T76ucl3+tCcdpJ0sd79qP5U=; b=fIyZ35uMm6/wnlEkBZDk6hgYE9vC2hnhHHkaVOZaGvfbqG9hHwTYxHevFfcpsoJVNi WlLD2XFQnZEHtvuF8xoggW48ztWhoNmzcv2lV09x9sO+HGXIJLcGklQpsF9QJiFZO4WM f26lrvg4u/HGWb+iTE00Av1NMxTg1Jzit7IQgquOl2Ek2Rusht8ntplzP9fBB0DVYyP/ An39ctNPHKI40vTD6TuRpBr4Rq4DGlDdu0xEuTCy20j0qdEDeZIjOVZX6YMloJM7du9X m0XJJcQc1rcaIPLsUzt6tRkbWYG5CxssAcTfTGnaNC7Y2yLVbV58/jEdvdoO+gG+KFcC iKCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=GlyurQg0; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k29-20020a634b5d000000b004786a8301c3si8277658pgl.586.2022.12.02.19.26.26; Fri, 02 Dec 2022 19:26:34 -0800 (PST) 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=@mediatek.com header.s=dk header.b=GlyurQg0; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbiLCDWm (ORCPT + 66 others); Fri, 2 Dec 2022 22:22:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbiLCDWk (ORCPT ); Fri, 2 Dec 2022 22:22:40 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF5A2C7B for ; Fri, 2 Dec 2022 19:22:34 -0800 (PST) X-UUID: 9134f955d1ee4410b1568388475e1767-20221203 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=qxn7s+B8JwIhyxqEztH5T76ucl3+tCcdpJ0sd79qP5U=; b=GlyurQg0hDhXCAHJwe9KQLTJ2xdTpOHb4KKryRzBrolkUy2SDC/GrRtCuCx6jFlIEDCPjJ6ivyvmfGON1oo0jC8Vai4/2lGyvSSeLsHptVN+EOYJ8vauxnJS9hjQMZuwrlfZyVC9Rk3i9GxCYFrvK+VnDyikXPT2vtqGh7HjYXo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:a670c786-6979-4aa1-855d-c104c6483707,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:dcaaed0,CLOUDID:b04d6e6c-41fe-47b6-8eb4-ec192dedaf7d,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 9134f955d1ee4410b1568388475e1767-20221203 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1787189263; Sat, 03 Dec 2022 11:22:28 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Sat, 3 Dec 2022 11:22:27 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Sat, 3 Dec 2022 11:22:27 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH 3/4] wifi: mt76: mt7996: fix insecure data handling of mt7996_mcu_rx_radar_detected() Date: Sat, 3 Dec 2022 11:22:24 +0800 Message-ID: <924d203f061a5bf98c4ade208a88d27b68b2730b.1670037462.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY 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 Coverity message: using tainted "r->band_idx" variable as an index into an array "(*dev).mt76.phys". Reported-by: coverity-bot Addresses-Coverity-ID: 1527812 ("Insecure data handling") Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Ryder Lee --- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c index a90b7ca2df63..efb245c8ac84 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c @@ -335,6 +335,9 @@ mt7996_mcu_rx_radar_detected(struct mt7996_dev *dev, struct sk_buff *skb) r = (struct mt7996_mcu_rdd_report *)skb->data; + if (r->band_idx >= ARRAY_SIZE(dev->mt76.phys)) + return; + mphy = dev->mt76.phys[r->band_idx]; if (!mphy) return; -- 2.18.0