Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2939815rwb; Mon, 15 Aug 2022 14:28:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4C8iVrfS+kX42P9CPNw56mgCsofivPDxTN+gZmahy2+iIcirSczurTPrcslSsV3/sM/h+0 X-Received: by 2002:a17:906:58d6:b0:733:77c:5ed1 with SMTP id e22-20020a17090658d600b00733077c5ed1mr11674646ejs.454.1660598934213; Mon, 15 Aug 2022 14:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598934; cv=none; d=google.com; s=arc-20160816; b=DgtWautyaBfuuMl/gI9I+SdAl7yuq0ry32YRT09ItRauNPsi9CbvK0LJlDwIJjy98S 6yYADuLu9MC/IfP/jmUGHR1918XZj3tJaiMUzvBKSyzLHni/U/hl5oBAnyMrcoBE4mOu EKIQRkxFqf5ocTKN/MUW1V3sAh5KRH727WShBqgZXUH/2pJudXtGlhyAR0DfNjXZkGJY VZS32nxuRRgPd92KA2nzN6JoC+HNwGVUYLjIZmUkz8RBg2XerpOoXz6ecAI29NvgUV4G dqCW8Y/y9cpE6I9/FOEOAwTCNrNZK4jB2+0RV5RsdYRYB4u9bVnLQf5cJgxIEEccusbs Bwjg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nc3ETmrcp2rHIh8cOILvSuRwDeLR/uihWYg7Dtnm2U8=; b=hukTsHek6sbSr9NYokRhJY9jggcke4G2ot0vJKAjoy4qM9Bs3Y3+VHMkV/KeY948WX EV0W46vUgNcddsb+0vZTtxz3SvRcXSw8r67K7I5akh3cDVWqUILpPZGwTMNo6tqxC+sn R9UE+jd5I8dUqmbNZug1Cf1/gkLDa4BeaAKfaCdxI6Qj6Wj+ODP3ewupizzTNA0xkbNH jF6+0h6nNdW4IiEKSdPAOlGmaVYrDw0/4yppfAAynV29vCNixL/D88r7DSmwpL7Z9jHP BkGJiQCjDx2ar1UnSL1ZgAke9n6aZMNYJUikRtPn7NNFUnFH7Y7VlyAJ29bbXZ4jW9PC n8hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UQanQNQc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f27-20020a170906049b00b007311b7d141dsi8126038eja.595.2022.08.15.14.27.57; Mon, 15 Aug 2022 14:28:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=UQanQNQc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346773AbiHOVYm (ORCPT + 99 others); Mon, 15 Aug 2022 17:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346418AbiHOVSE (ORCPT ); Mon, 15 Aug 2022 17:18:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E7172E9D9; Mon, 15 Aug 2022 12:21:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F6D1B81120; Mon, 15 Aug 2022 19:21:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69D20C433C1; Mon, 15 Aug 2022 19:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591280; bh=yvkrzACW/qrxgj1lX7sug5NglxA19jWHmopMFD2FfTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UQanQNQcWxSOWebk+7djiyA4tLMIX79x0PUb1N/W0huSnFseTo29b/EBnzyjRTZwl Us+IPsXLL5gJ47Xzp7s2IFovuP94JgKDx4SOg7BPwClm7Eokyh3fGixtfd5nb5BF1L NjX7xjEI6cl1Q7qABkIp8wtwPSwtY17XVcdwHD3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 0528/1095] wifi: rtw88: check the return value of alloc_workqueue() Date: Mon, 15 Aug 2022 19:58:47 +0200 Message-Id: <20220815180451.387059444@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org From: William Dean [ Upstream commit 42bbf810e155efc6129a3a648ae5300f00b79d7b ] 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 Reviewed-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220723063756.2956189-1-williamsukatube@163.com Signed-off-by: Sasha Levin --- 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 8b9899e41b0b..ded952913ae6 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1974,6 +1974,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.35.1