Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp562210rwb; Wed, 18 Jan 2023 22:56:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXs4SXE6VOhe4Dt0wbRWvKMyRq/705CY5+NZvdu7SUJYu8wofpUZAm9T0BsP+829dR2HDBhw X-Received: by 2002:a17:906:1e42:b0:86f:763c:2695 with SMTP id i2-20020a1709061e4200b0086f763c2695mr9149743ejj.17.1674111390108; Wed, 18 Jan 2023 22:56:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674111390; cv=none; d=google.com; s=arc-20160816; b=FiYQLHt2EaAIJLCVR2qKF2YW2wuSIUtsS2hq1Oj+sezMIw/i5s4w8mKs/Qlrwo98FH w/ztj5d/PJAIluPlHin4W1A3gZbGdPETldSHsUVZEHGEWLxTLNoA2iOS+mksJYmXPVap pRYY4ZS7oh6BshR9orL/Qd1xIaEVhbasIiEYKc7RGWrzbhoLFj7Kjlt6rZsxWA/9pvAt pxejvaKx6HRHznsrsqyVOd5jDtg+RdmovDYRG8nEqTtBDvUYdySgjEYEsQnRsE4tMvx7 IM6T4/gk0SRCPmrAkUZP4ohmyUc7TOvSF/iRADdPKoMJToUjg1KMzLXFDsasupHrDOSQ Sovw== 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 :authenticated-by; bh=/GOsXoIwpBTZAzDKNmzecHVN3ajRzp9Ymy2jrZk4a9w=; b=PN0SKctUWd5VgQEiu8V8x4hzFXtrWgZ3O/c11FP4QYBtg1ylbcRa3wqpMaN6WNsa0Z 4ZxSOJM57QXEkXcccZ4W18P/B4Jwkp+AhYhWXIUPE1VVL3fcNxWMiG/HFMEhD6No1gfU bpF+WsaA0z4q7k8BmGSda8PnmyOPBhPcAmEZbsCXrt7VrCuNf/umluUkt3ARDnsEAO6U O0ySBWaAYEqf4En40mCH0pL2ddpu3F9HzUTZ0pL34q54asaMv6lr9gg6gT3O57ZHVdtu I7mYTe5kCfPGlmkpUeSh00vgTCj31p5Mw2DAdUTL5z7TufMvp9BDwLj4JuIY4t/SMLxJ wowQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc3-20020a1709078a0300b0087769779d12si2402567ejc.820.2023.01.18.22.56.14; Wed, 18 Jan 2023 22:56:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229797AbjASGgB (ORCPT + 63 others); Thu, 19 Jan 2023 01:36:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229656AbjASGf6 (ORCPT ); Thu, 19 Jan 2023 01:35:58 -0500 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0051F3C21 for ; Wed, 18 Jan 2023 22:35:56 -0800 (PST) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 30J6Zm222012547, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 30J6Zm222012547 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Thu, 19 Jan 2023 14:35:49 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Thu, 19 Jan 2023 14:35:50 +0800 Received: from localhost (172.21.69.188) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 19 Jan 2023 14:35:49 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH 1/2] wifi: rtw89: debug: avoid invalid access on RTW89_DBG_SEL_MAC_30 Date: Thu, 19 Jan 2023 14:35:28 +0800 Message-ID: <20230119063529.61563-2-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230119063529.61563-1-pkshih@realtek.com> References: <20230119063529.61563-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.188] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: trusted connection X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Deterministic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 01/19/2023 06:15:00 X-KSE-AttachmentFiltering-Interceptor-Info: no applicable attachment filtering rules found X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: =?big5?B?Q2xlYW4sIGJhc2VzOiAyMDIzLzEvMTkgpFekyCAwMzozNzowMA==?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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: Zong-Zhe Yang Only 8852C chip has valid pages on RTW89_DBG_SEL_MAC_30. To other chips, this section is an address hole. It will lead to crash if trying to access this section on chips except for 8852C. So, we avoid that. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/debug.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/debug.c b/drivers/net/wireless/realtek/rtw89/debug.c index 8297e35bfa52b..6730eea930ece 100644 --- a/drivers/net/wireless/realtek/rtw89/debug.c +++ b/drivers/net/wireless/realtek/rtw89/debug.c @@ -615,6 +615,7 @@ rtw89_debug_priv_mac_reg_dump_select(struct file *filp, struct seq_file *m = (struct seq_file *)filp->private_data; struct rtw89_debugfs_priv *debugfs_priv = m->private; struct rtw89_dev *rtwdev = debugfs_priv->rtwdev; + const struct rtw89_chip_info *chip = rtwdev->chip; char buf[32]; size_t buf_size; int sel; @@ -634,6 +635,12 @@ rtw89_debug_priv_mac_reg_dump_select(struct file *filp, return -EINVAL; } + if (sel == RTW89_DBG_SEL_MAC_30 && chip->chip_id != RTL8852C) { + rtw89_info(rtwdev, "sel %d is address hole on chip %d\n", sel, + chip->chip_id); + return -EINVAL; + } + debugfs_priv->cb_data = sel; rtw89_info(rtwdev, "select mac page dump %d\n", debugfs_priv->cb_data); -- 2.25.1