Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10470233rwd; Wed, 21 Jun 2023 23:54:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WRmBV15t6odrp0C6B9mlxH/f9zkfVFERSAycC3BDHvQJL7bPsh3vijJGSq4NKOwtt1Eev X-Received: by 2002:a67:ec4c:0:b0:43f:6dff:cfc5 with SMTP id z12-20020a67ec4c000000b0043f6dffcfc5mr5570751vso.0.1687416884874; Wed, 21 Jun 2023 23:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687416884; cv=none; d=google.com; s=arc-20160816; b=YvV7142yPHA/kx+Q7eRDiLk+q8qavPXmnTbTS2jVYAWrBK/4iCFAR22jInO9eymHh6 zwajyI8y06/94c4A7k7v4amvqf/z8+aDxsAcGUKqYjEjwaNSPU7P+Iw5UB71VYRapoRE YJc7u+TnVejw4HmiBgoBFfhfjCs4LD6BWjnpTQ1HsZs07BgykoTQT+lUZAvRmTA1yX7n 471gFOqkSqBjkM9aK1hezj3GDAwkWSKW0/P8/Wei9CLQCFDvhj8YZqcxF65TyamcJzNs M+0ls2nglxYBcGkpJvOW38wI6Fq8vhPcMQ5voHCbheGKSI2n+A8bUDtEwxyheChX1YmX 08Uw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=GP8UjbhXzWfTOijSVhz39D09FTFIms4JHl4jpigR9rg=; b=ReLTB8PVlgJueaaCx2zzUkbzlc17a7Wdqd/VrCG8ngRk/yvRTr53sCiHlAkkRUFqvO w+CtanLnotSZZQGOgN1P9MPREAI6LTuGduZT1xFoc3+G1OlUPwlrEXM+NYZcXYa7psQS q98u3U3cfQzZkKAbh9ntsattdpp+2acCga/A+FPnQNSp6+p2LsjKK42+LlFDyGxlMxhr uvGkv60AvChShcEkDVc3egJkywAUwT/zFPVNiJpeKB1NJEPLJPcUg+2yeHycvXrW1d4H mZZWue4slskB4lvSOsI6eqnFs8L86OVhC2mzaRb4XVAa2Bg4OifHLxKCs0DpDO+yguRa DDOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=IleDaqam; 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=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v18-20020a637a12000000b0054201a157fesi5783144pgc.427.2023.06.21.23.54.34; Wed, 21 Jun 2023 23:54:44 -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; dkim=pass header.i=@yandex.ru header.s=mail header.b=IleDaqam; 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=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbjFVGoe (ORCPT + 60 others); Thu, 22 Jun 2023 02:44:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229673AbjFVGod (ORCPT ); Thu, 22 Jun 2023 02:44:33 -0400 Received: from forward102b.mail.yandex.net (forward102b.mail.yandex.net [178.154.239.149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5087A19AF for ; Wed, 21 Jun 2023 23:44:30 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:6e01:0:640:627f:0]) by forward102b.mail.yandex.net (Yandex) with ESMTP id 87CF56002F; Thu, 22 Jun 2023 09:44:27 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id Qi9Pt8GDVCg0-yqIMKypt; Thu, 22 Jun 2023 09:44:27 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1687416267; bh=GP8UjbhXzWfTOijSVhz39D09FTFIms4JHl4jpigR9rg=; h=Message-ID:Date:Cc:Subject:To:From; b=IleDaqamKF4bzY2Cz4amK74Fyr8RMKzGcJPo6392zeLIR1MYHzh4mk4/c/ZY6Nrbt WmC3NDIKsfx8WbJ3jFom4gpwl9n4XjhRDRpKM3mZMEBJzbU9hsVhK02e6oBudtbYEL 5P9yCiJuF0VIyNm3zAVUUR2OkGBBOYUkice0+5BQ= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Po-Hao Huang Cc: Kalle Valo , linux-wireless@vger.kernel.org, Dmitry Antipov , Ping-Ke Shih Subject: [PATCH 1/4] [v5] wifi: rtw88: delete timer and free skb queue when unloading Date: Thu, 22 Jun 2023 09:44:15 +0300 Message-ID: <20230622064424.38498-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 Fix possible crash and memory leak on driver unload by deleting TX purge timer and freeing C2H queue in 'rtw_core_deinit()', shrink critical section in the latter by freeing COEX queue out of TX report lock scope. Reviewed-by: Ping-Ke Shih Signed-off-by: Dmitry Antipov --- v5: adjust to match recent changes v4: adjust to match series v3: shrink critical section in rtw_core_deinit() (Ping-Ke Shih) v2: fix title and commit message (Kalle Valo) --- drivers/net/wireless/realtek/rtw88/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index c853e2f2d448..c2ddb4d382af 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -2183,10 +2183,12 @@ 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); spin_unlock_irqrestore(&rtwdev->tx_report.q_lock, flags); + skb_queue_purge(&rtwdev->coex.queue); + skb_queue_purge(&rtwdev->c2h_queue); list_for_each_entry_safe(rsvd_pkt, tmp, &rtwdev->rsvd_page_list, build_list) { -- 2.41.0