Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3550578pxj; Mon, 24 May 2021 09:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHnXSmZQS5cjVMuNi3kxz+d+4HH/mBvpQCqiq8IM/gXrVNSKUV9MmdDa/tJredxAQ0BQRf X-Received: by 2002:a17:906:f84:: with SMTP id q4mr24602903ejj.442.1621872628314; Mon, 24 May 2021 09:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872628; cv=none; d=google.com; s=arc-20160816; b=eCP/V3vc1+Fn4BU7+0MT23feHnQ+2aMunIEi8evTSj0TZ0sE6r4L1SuTIrSuehAasK gtsv+KenU9nPEaQ32Valoyh0prhXsdtMy7W8h210zZeTSIcjvpGEk02cyIQSMhdkDmPv uBYnd9ou4PXhRCR8Qx5K0/tNx9cM1cRz10M/vCMjt/ed4Ulw33gdEx+j+Uo4TnA2QeVO VInVsW3cautYZU3DJoxqfqICQglELZ92ccxB5D5nwX4wcX7a7dMglEgU5uegiluOJLbF IIyai7UNyhJYoo4UT/XFjsIVkj00DPxgKjaNSFqefq7a/R1k5UhVDbh9l7qr+GxEg1IU tzIw== 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=nXKloOUbIJWLsayv38KAauy4PDX+wzk6E7B9RjG/39w=; b=f2NEe2riN+e55QeF8HTjrtzJGKBKdrWp4xlbvJrV/jv5E4OnoEP6Eg3hxb4yIdEtrh Y184xslGLPFKyT3hm8fEMWb83aepqAdFRuATdgfWRJiOF7iwTuhRg+BVF0g7Kx9CYJ4O 9164hEq2MchBDjaQRCixFpi9dlJk4Ea+Xr2yu1kjNSaay5BuNc2vdx9h/9mzzn3uft4e DnCFXaVMdkoMBLeNJCweAHsauO3osJNGegfHF7f7RNRapgEFywen5352RGPr5t8GH0/C R89NKDtSCsADZX2X7h7az974iCB/hwp+FwSmASKnKdHXY/0reSKwcMz7LoEi0u2yhmrE PyFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UXOhp9OG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si14555690edq.235.2021.05.24.09.10.05; Mon, 24 May 2021 09:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UXOhp9OG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S236704AbhEXQJH (ORCPT + 99 others); Mon, 24 May 2021 12:09:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:42580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235537AbhEXQA4 (ORCPT ); Mon, 24 May 2021 12:00:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C20A61995; Mon, 24 May 2021 15:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871185; bh=w8AofuxdJMLE8NjVCLMel5ry4/86pey5fHiGwP8Fn14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UXOhp9OGv1T/TZy226Hr2LOKYgEIQzM6lPs5/4brjYkTqq6TSdwkvQtJEH+i037xL thmXh/9/16hxW7iCh0gNU3he2gdgzIqw37svrKXCuNSSloWg62B9OOtV6y6Yfu5/5i UWOTxBiqbaQ5zGG4pcqPtgk38nPd1GDNRvr3AWNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kalle Valo , Bryan Brattlof Subject: [PATCH 5.12 113/127] net: rtlwifi: properly check for alloc_workqueue() failure Date: Mon, 24 May 2021 17:27:10 +0200 Message-Id: <20210524152338.682934928@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman commit 30b0e0ee9d02b97b68705c46b41444786effc40c upstream. If alloc_workqueue() fails, properly catch this and propagate the error to the calling functions, so that the devuce initialization will properly error out. Cc: Kalle Valo Cc: Bryan Brattlof Cc: stable Link: https://lore.kernel.org/r/20210503115736.2104747-14-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/realtek/rtlwifi/base.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -440,9 +440,14 @@ static void rtl_watchdog_wq_callback(str static void rtl_fwevt_wq_callback(struct work_struct *work); static void rtl_c2hcmd_wq_callback(struct work_struct *work); -static void _rtl_init_deferred_work(struct ieee80211_hw *hw) +static int _rtl_init_deferred_work(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = rtl_priv(hw); + struct workqueue_struct *wq; + + wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); + if (!wq) + return -ENOMEM; /* <1> timer */ timer_setup(&rtlpriv->works.watchdog_timer, @@ -451,7 +456,8 @@ static void _rtl_init_deferred_work(stru rtl_easy_concurrent_retrytimer_callback, 0); /* <2> work queue */ rtlpriv->works.hw = hw; - rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); + rtlpriv->works.rtl_wq = wq; + INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, rtl_watchdog_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, @@ -461,6 +467,7 @@ static void _rtl_init_deferred_work(stru rtl_swlps_rfon_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback); + return 0; } void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq) @@ -560,9 +567,7 @@ int rtl_init_core(struct ieee80211_hw *h rtlmac->link_state = MAC80211_NOLINK; /* <6> init deferred work */ - _rtl_init_deferred_work(hw); - - return 0; + return _rtl_init_deferred_work(hw); } EXPORT_SYMBOL_GPL(rtl_init_core);