From patchwork Fri Sep 27 10:36:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1990220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XFRjN6lZxz1xt9 for ; Fri, 27 Sep 2024 20:36:56 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1su8LA-0005uJ-EB; Fri, 27 Sep 2024 10:36:48 +0000 Received: from mail-pg1-f170.google.com ([209.85.215.170]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1su8L9-0005to-3O for kernel-team@lists.ubuntu.com; Fri, 27 Sep 2024 10:36:47 +0000 Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-7db1f13b14aso1563297a12.1 for ; Fri, 27 Sep 2024 03:36:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727433405; x=1728038205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LSM/LnaiYvQ/nqEwcU2cbfpK1YFoe7Jmoy3vzCsN/V0=; b=c/5mMp/I1K2e2Ku7pxAdfDKXARY4NazUqGtY4HkGTQRFCGcOVVK72Tse60fhSqWCoT ccK7349rOdhFPjDMky4BIGxsHh66wGa07h1CX1qmkTDLaQG5vBd+1O8JMUMW4Ny45UHX bc0kt6CcjygdH0uvf8kG/iZtEhZvprtrmarDtKg3izfujq1KI8p+lnZSLebLvwrTkUxx ktKPGj/UIvYuZa0R/AwPqzvFaSsVBo53nzr9hxK49fLJQNrRqe3QNG1GwUyo7hzLln9g 12LVLYo7lOTR23bQ88d6QiUK0fKI59e07Za7wvFG8uDIbYKAx+t5hZDO9V8rWoXlDOpe 9dxw== X-Gm-Message-State: AOJu0YyVrWv9uRKy5X/B0U/EGSSCrHVPaxo9a9WKHTq0/Tqxt/X3v0qE 9QgaT8ZqpreR4b+QxFm94PRdLcbuw9g1GyezP8lDMUzdLX85QNECs8rQAQ== X-Google-Smtp-Source: AGHT+IHSI5PkIAImX5eD8Th47gignObLXBDq+k/Fp2lJm/Xf3GJ90FjfsMSbjWnYSINsgk9RGw31KQ== X-Received: by 2002:a05:6a21:6481:b0:1d2:e9e8:5e78 with SMTP id adf61e73a8af0-1d4fa6c3974mr4403624637.23.1727433404836; Fri, 27 Sep 2024 03:36:44 -0700 (PDT) Received: from localhost.localdomain (125-229-129-140.hinet-ip.hinet.net. [125.229.129.140]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71b2653663asm1298801b3a.187.2024.09.27.03.36.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Sep 2024 03:36:44 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][Unstable][Oracular][Noble] wifi: mt76: mt7925: fix a potential array-index-out-of-bounds issue for clc Date: Fri, 27 Sep 2024 18:36:06 +0800 Message-ID: <20240927103606.2831505-2-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240927103606.2831505-1-vicamo.yang@canonical.com> References: <20240927103606.2831505-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.170; envelope-from=vicamo@gmail.com; helo=mail-pg1-f170.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Ming Yen Hsieh BugLink: https://bugs.launchpad.net/bugs/2081785 Due to the lack of checks on the clc array, if the firmware supports more clc configuration, it will cause illegal memory access. Cc: stable@vger.kernel.org Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") Signed-off-by: Ming Yen Hsieh Link: https://patch.msgid.link/20240819015334.14580-1-mingyen.hsieh@mediatek.com Signed-off-by: Felix Fietkau (cherry picked from commit 9679ca7326e52282cc923c4d71d81c999cb6cd55) Signed-off-by: You-Sheng Yang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index e1dd89a7a79ca..bb171ba8177b1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -613,6 +613,9 @@ static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name) for (offset = 0; offset < len; offset += le32_to_cpu(clc->len)) { clc = (const struct mt7925_clc *)(clc_base + offset); + if (clc->idx > ARRAY_SIZE(phy->clc)) + break; + /* do not init buf again if chip reset triggered */ if (phy->clc[clc->idx]) continue;