Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1261317imi; Fri, 22 Jul 2022 23:39:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+M9/EXvVIOc+qpf87KKL2WjM5pOIC+djaj7zmetHj/LE/pdqoDh5xR182G2akRZ2rpbHE X-Received: by 2002:a17:907:a076:b0:72b:4ad1:53ba with SMTP id ia22-20020a170907a07600b0072b4ad153bamr2395895ejc.685.1658558393082; Fri, 22 Jul 2022 23:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658558393; cv=none; d=google.com; s=arc-20160816; b=S3AZhnS2glWTnp7AjYJScrOUt46OVuDMENsy9dECWkgAiCXdxqk/Ue8YhW3rEZ7XXs a/2JKyDZB7fQSq8HP+GzFCe8+5QHzSziwVGyErF5QwlFc+8XMhiIcaVi6ti9ywQwqi9J A+RtCtlKo9DCTryfTqfNR5OQQThRrFRFz3rmVPCt2crfwwgWwjAi7W8Yd4BT+fXp7py+ ms8PuREQUTFaV/A9PkOvyfYScDIV48tuDewH/K8c/HUe3YYoQ9OE2H2Wqx8UwdyNeDG/ Q6/I8l5Gihi/x5iydcVksCz3/uQXYzd3j9RXp8tAWqhaWW4LpQyvldkUu4OnZhbP79lb Xz8A== 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=ghGvYr984FDqS6i/4Wzdk3AISc6OUN356jDYgZPRZuk=; b=ORCRqoY5MqUohtYGdlxJmh5kUxfdYEj5IHJDJQE8ev/s2Oet87Ku3ibk2mxIjKa/u/ +BMQm+Yli54FA5/OhgX8fLUr77iNQL0eHcm8/DMed889nDTR0vbhsrnoddgZQAPIEfbD /1lLm++ZX7EWKqfBn8EK0vzcGPMGHMndTsR65faaTc3q4is4nB5S7tVBntbYIGafq6uZ A9GCkaLX74PDuiSbYAXwCcaDrGwKHBDdTwVb0ecOWDcwhKCGXZRDO5P8HLAlcBUpSH5n pAxb2/AUb+s11g4j5p+/K1EhETF4ejypyp17+HPcR+bW+liw1NLaE4eu+kb8MsGpVyN8 eR3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="l1Gg+HJ/"; 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=163.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw26-20020a1709066a1a00b0072697822ec7si8743900ejc.253.2022.07.22.23.39.29; Fri, 22 Jul 2022 23:39:53 -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=@163.com header.s=s110527 header.b="l1Gg+HJ/"; 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=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231272AbiGWGj0 (ORCPT + 65 others); Sat, 23 Jul 2022 02:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbiGWGj0 (ORCPT ); Sat, 23 Jul 2022 02:39:26 -0400 Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 570BD140CE; Fri, 22 Jul 2022 23:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=ghGvY r984FDqS6i/4Wzdk3AISc6OUN356jDYgZPRZuk=; b=l1Gg+HJ/yum4s9wrE9HmW Tl+AJXwAWHhqwSP2CNeWXSVHy7hyatvaru8/VHCxmIT3O4PuE5uTcL268kLx8tqY UT+cqGVcRcCM3T8M/u15bwv3EpKoqrFoMbui+gYPXDLGYlZXRBZN21C8WjTd3QNf Ko6nxhycL1nyI5dSE/t2Kw= Received: from localhost.localdomain (unknown [123.58.221.99]) by smtp1 (Coremail) with SMTP id GdxpCgAXKHNGl9tiDqPaPw--.18361S2; Sat, 23 Jul 2022 14:38:00 +0800 (CST) From: williamsukatube@163.com To: tony0620emma@gmail.com, kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: William Dean , Hacash Robot Subject: [PATCH] rtw88: check the return value of alloc_workqueue() Date: Sat, 23 Jul 2022 14:37:56 +0800 Message-Id: <20220723063756.2956189-1-williamsukatube@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgAXKHNGl9tiDqPaPw--.18361S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tryUAFyxJw18Xr4kGryDWrg_yoW8JFWfpa 98WwnrCasxKw1UAa1jq3WYyFn8X3W8KF9rZr9avw4rZ3y8ZFyrAa4YqF9FvrZ0krWjgF43 ArsYgr9xG3Z0vFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bw89NUUUUU= X-Originating-IP: [123.58.221.99] X-CM-SenderInfo: xzlozx5dpv3yxdwxuvi6rwjhhfrp/1tbiUQhHg2DEOrzTiQAAsl 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, RCVD_IN_DNSWL_NONE,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: William Dean The function alloc_workqueue() in rtw_core_init() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code. Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue") Reported-by: Hacash Robot Signed-off-by: William Dean --- drivers/net/wireless/realtek/rtw88/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index efabd5b1bf5b..645ef1d01895 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1984,6 +1984,10 @@ int rtw_core_init(struct rtw_dev *rtwdev) timer_setup(&rtwdev->tx_report.purge_timer, rtw_tx_report_purge_timer, 0); rtwdev->tx_wq = alloc_workqueue("rtw_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0); + if (!rtwdev->tx_wq) { + rtw_warn(rtwdev, "alloc_workqueue rtw_tx_wq failed\n"); + return -ENOMEM; + } INIT_DELAYED_WORK(&rtwdev->watch_dog_work, rtw_watch_dog_work); INIT_DELAYED_WORK(&coex->bt_relink_work, rtw_coex_bt_relink_work); -- 2.25.1