Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2306244rwl; Sat, 1 Apr 2023 05:46:18 -0700 (PDT) X-Google-Smtp-Source: AKy350bSuD/bA3zYEfiRazGpKCZ1xAyVfjngJp7DqN8yAS52q9vAU5fOfOLDpgdkEPFXPjbo2y2l X-Received: by 2002:a17:906:fcc:b0:879:d438:4d1c with SMTP id c12-20020a1709060fcc00b00879d4384d1cmr32994481ejk.21.1680353178137; Sat, 01 Apr 2023 05:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680353178; cv=none; d=google.com; s=arc-20160816; b=gcTNXjEuZv+oKzGkVDUTULyxEyoACAwgPH6pY/soxv2iyk0Lz6xQNECS086mgCDXQR uAu1vb+gLAaL3CVmmyzUUTPaO9KVt2e1SKk/vwqoo5Qze/tZ4GYIzMrs+gJEPVqc8lc7 XVrLphT3mQfok4YJT3hfK7Xura5weRZ3wQtyiQo+y7KNtw/b7qSfG9nZ7O+H865XhxZj 8r2DmGbwOM7RTyfh/01RdfPheeY0sy+xs800yPXaRHU3lxMlktkgAl8zwmvoAnTFS5rV R0Mm9+rY8qpY0P56mCatfnB1/RVgDd3gbeZI3cnnp5bhiGm+In4PUOPLCVvLDDLsw9Qy sznA== 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=WNuabM55yfr44qIIc5PSqcNXpO9GE3OXelTfbj7zTrc=; b=LJ8DU1NOwnrsuwflG1QkCY2KsbqSPGBL/YviNQ4QmoudZZ7LdQpVTLjPVhJUK+RZux N3g6k6fu9wfXMzRdc0tdMb+xv5jg9ebrMCLY5u5jvBNjngQ8PMGV4xGAl59iiZzpZobu Rv88voOEG6DtCv8Pzqx63vLrO+PzNR0u/SqiBzfoBMPxu3FJzRJ7oAn+5TN0xKIv/wlZ xq4cOzEns4r4bK+kE1p/d/GCVccvS1ZQvXkLX4NKAOIDqo3jUnIOiJixZLdLfPPXMGKX fOSXnVUwJLWzdoD8ZXQnfK2h1iLNdaoLrzwxyd6kRlQVEznxAtYLTGDpUuLxPzfYLiUg zNwA== 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 i19-20020a17090685d300b008d6385c40c4si4078897ejy.696.2023.04.01.05.45.55; Sat, 01 Apr 2023 05:46:18 -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; 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 S229738AbjDAMpv (ORCPT + 58 others); Sat, 1 Apr 2023 08:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjDAMps (ORCPT ); Sat, 1 Apr 2023 08:45:48 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0191E20318 for ; Sat, 1 Apr 2023 05:45:45 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 331CjI8T1021691, 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 331CjI8T1021691 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Sat, 1 Apr 2023 20:45:18 +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; Sat, 1 Apr 2023 20:45:36 +0800 Received: from localhost (172.16.16.15) 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; Sat, 1 Apr 2023 20:45:35 +0800 From: Ping-Ke Shih To: , CC: , Subject: [PATCH 6/7] wifi: rtw88: prevent scan abort with other VIFs Date: Sat, 1 Apr 2023 20:44:09 +0800 Message-ID: <20230401124410.33221-7-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230401124410.33221-1-pkshih@realtek.com> References: <20230401124410.33221-1-pkshih@realtek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.16.16.15] 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: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: Po-Hao Huang Only abort scan with current scanning VIF. If we have more than one interface, we could call rtw_hw_scan_abort() with the wrong VIF as input. This avoids potential null pointer being accessed when actually the other VIF is scanning. Signed-off-by: Po-Hao Huang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw88/fw.c | 4 +++- drivers/net/wireless/realtek/rtw88/fw.h | 2 +- drivers/net/wireless/realtek/rtw88/mac80211.c | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/fw.c b/drivers/net/wireless/realtek/rtw88/fw.c index 049473accdb97..f2d48091b1e98 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.c +++ b/drivers/net/wireless/realtek/rtw88/fw.c @@ -2163,8 +2163,10 @@ int rtw_hw_scan_offload(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, return ret; } -void rtw_hw_scan_abort(struct rtw_dev *rtwdev, struct ieee80211_vif *vif) +void rtw_hw_scan_abort(struct rtw_dev *rtwdev) { + struct ieee80211_vif *vif = rtwdev->scan_info.scanning_vif; + if (!rtw_fw_feature_check(&rtwdev->fw, FW_FEATURE_SCAN_OFFLOAD)) return; diff --git a/drivers/net/wireless/realtek/rtw88/fw.h b/drivers/net/wireless/realtek/rtw88/fw.h index 0a386e6d6e0d1..397cbc3f6af6e 100644 --- a/drivers/net/wireless/realtek/rtw88/fw.h +++ b/drivers/net/wireless/realtek/rtw88/fw.h @@ -868,5 +868,5 @@ int rtw_hw_scan_offload(struct rtw_dev *rtwdev, struct ieee80211_vif *vif, bool enable); void rtw_hw_scan_status_report(struct rtw_dev *rtwdev, struct sk_buff *skb); void rtw_hw_scan_chan_switch(struct rtw_dev *rtwdev, struct sk_buff *skb); -void rtw_hw_scan_abort(struct rtw_dev *rtwdev, struct ieee80211_vif *vif); +void rtw_hw_scan_abort(struct rtw_dev *rtwdev); #endif diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c index 1c2213957f449..41a9e4fe58b47 100644 --- a/drivers/net/wireless/realtek/rtw88/mac80211.c +++ b/drivers/net/wireless/realtek/rtw88/mac80211.c @@ -393,7 +393,8 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw, * when disconnected by peer */ if (test_bit(RTW_FLAG_SCANNING, rtwdev->flags)) - rtw_hw_scan_abort(rtwdev, vif); + rtw_hw_scan_abort(rtwdev); + } config |= PORT_SET_NET_TYPE; @@ -873,7 +874,7 @@ static int rtw_ops_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, rtw_hw_scan_start(rtwdev, vif, req); ret = rtw_hw_scan_offload(rtwdev, vif, true); if (ret) { - rtw_hw_scan_abort(rtwdev, vif); + rtw_hw_scan_abort(rtwdev); rtw_err(rtwdev, "HW scan failed with status: %d\n", ret); } mutex_unlock(&rtwdev->mutex); @@ -893,7 +894,7 @@ static void rtw_ops_cancel_hw_scan(struct ieee80211_hw *hw, return; mutex_lock(&rtwdev->mutex); - rtw_hw_scan_abort(rtwdev, vif); + rtw_hw_scan_abort(rtwdev); mutex_unlock(&rtwdev->mutex); } -- 2.25.1