Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1913761rwd; Thu, 15 Jun 2023 18:20:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OJiOUVrvkh/XRyBUWQ+BBAdS4+8ylUrb+5+fMv8T8VVwz43QcCcjauUlgYhVCSQppqyC1 X-Received: by 2002:a05:622a:1045:b0:3f4:ee64:e30c with SMTP id f5-20020a05622a104500b003f4ee64e30cmr1106666qte.52.1686878417256; Thu, 15 Jun 2023 18:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686878417; cv=none; d=google.com; s=arc-20160816; b=JXecgxdNdQZe0JVFvSGyQkKRw5g++iknAbCEKQQR0G3+SdRpcoXjoB/MoWdLm8Em3P bc2hDyOXO7sbUIxe/MPab0fkalgAdLS85WxkIgxGMOFYV/si2poymx/TF46J9HMBIs+n wBBsWBCxNBOXfJX2eF92sbRGIm2K5dv8uyCGBJZAY0Jr52TK1GkWIQGM8mcMLC8ZvFn0 xMyQJEkCBzJJl77MW3g2ceaSJwlAR4ZVPIkQk7AJBt5bORGoMp68E05Jf4JXi9rZyH8T vyNgSL1EmEXPrtlhYdZd7Z8BYnb09U/RVXm3OoOKgGSx68MjSh2U/agUWcv4HTBo2T9r AdeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:authenticated-by; bh=P7GgXoxiycS+EAZ/xm7KOBhiDeRnEqr481c286SVONM=; b=NUNhz8NUN57Bbd590tcdpWQh4dttmWDWWJgX5yIw2V1hUiO7R2vKNHcxCy1FUO3JdQ b9F0tSGNQzRe3K/eIPlLU7ZNgDl63tRDzYHdtskm1zdnCof9B0cO1Abl0PG+s278fzNv lV5seYG9JA1Q6lQYU/TvJZ3dw0vZmT2YVZaPR38AR//WnwAfAU1zc+KvxXMvYaa03+dv xngW6BJHNVEjng/G+1PWYPLDAIGrnnD2sLEF3BmQu5qIOfY9PVgIy/KOcQx2fPezydsm Xj6ZthBD82RDmK5RXpUihu7V1pgIJ+hzZyjnQjdNWQ9VH26KxofRFJ/C1mWAjDHKVUrX fEfw== 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 o5-20020a637e45000000b0054f993d7f29si7883058pgn.563.2023.06.15.18.20.04; Thu, 15 Jun 2023 18:20:17 -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 S230115AbjFPBL0 convert rfc822-to-8bit (ORCPT + 61 others); Thu, 15 Jun 2023 21:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229991AbjFPBLY (ORCPT ); Thu, 15 Jun 2023 21:11:24 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D98A51FE2 for ; Thu, 15 Jun 2023 18:11:20 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 35G1Aqu16032174, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 35G1Aqu16032174 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK); Fri, 16 Jun 2023 09:10:52 +0800 Received: from RTEXDAG02.realtek.com.tw (172.21.6.101) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.17; Fri, 16 Jun 2023 09:11:10 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXDAG02.realtek.com.tw (172.21.6.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 16 Jun 2023 09:11:10 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::e138:e7f1:4709:ff4d]) by RTEXMBS04.realtek.com.tw ([fe80::e138:e7f1:4709:ff4d%5]) with mapi id 15.01.2375.007; Fri, 16 Jun 2023 09:11:10 +0800 From: Ping-Ke Shih To: Dmitry Antipov , Kalle Valo CC: Yan-Hsuan Chuang , "linux-wireless@vger.kernel.org" Subject: RE: [PATCH] [v2] wifi: rtw88: delete timer and free skb queue when unloading Thread-Topic: [PATCH] [v2] wifi: rtw88: delete timer and free skb queue when unloading Thread-Index: AQHZn5zgajoIIGul30uNrZf2KgsQxa+MmiZw Date: Fri, 16 Jun 2023 01:11:10 +0000 Message-ID: <5fb6969687da47b2a12cb35041accca2@realtek.com> References: <87leglaqkl.fsf@kernel.org> <20230615151911.5793-1-dmantipov@yandex.ru> In-Reply-To: <20230615151911.5793-1-dmantipov@yandex.ru> Accept-Language: en-US, zh-TW Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.21.69.188] x-kse-serverinfo: RTEXDAG02.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 > -----Original Message----- > From: Dmitry Antipov > Sent: Thursday, June 15, 2023 11:19 PM > To: Kalle Valo > Cc: Yan-Hsuan Chuang ; linux-wireless@vger.kernel.org; Dmitry Antipov > > Subject: [PATCH] [v2] wifi: rtw88: delete timer and free skb queue when unloading > > Fix possible crash and memory leak on driver unload by deleting > TX purge timer and freeing C2H queue in 'rtw_core_deinit()'. > > Signed-off-by: Dmitry Antipov > --- > v2: fix title and commit message (Kalle Valo) > --- > drivers/net/wireless/realtek/rtw88/main.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c > index 9447a3aae3b5..572fc126b9de 100644 > --- a/drivers/net/wireless/realtek/rtw88/main.c > +++ b/drivers/net/wireless/realtek/rtw88/main.c > @@ -2180,9 +2180,11 @@ void rtw_core_deinit(struct rtw_dev *rtwdev) > release_firmware(wow_fw->firmware); > > destroy_workqueue(rtwdev->tx_wq); > + timer_delete_sync(&rtwdev->tx_report.purge_timer); > spin_lock_irqsave(&rtwdev->tx_report.q_lock, flags); > skb_queue_purge(&rtwdev->tx_report.queue); > skb_queue_purge(&rtwdev->coex.queue); > + skb_queue_purge(&rtwdev->c2h_queue); rtwdev->tx_report.q_lock is used to protect rtwdev->tx_report.queue, so don't add to purge c2h queue in this critical section. I think coex.queue is the bad example. > spin_unlock_irqrestore(&rtwdev->tx_report.q_lock, flags); > > list_for_each_entry_safe(rsvd_pkt, tmp, &rtwdev->rsvd_page_list, > -- > 2.40.1