Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3542457pxj; Mon, 24 May 2021 09:01:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUlUsGek77g/1XYMKs+EKz7nLKZQ/t+unnil3JDmZTKvnFK/oYR7R8VuSAykjsLcPlFMEj X-Received: by 2002:a05:6e02:e05:: with SMTP id a5mr14465258ilk.235.1621872112426; Mon, 24 May 2021 09:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872112; cv=none; d=google.com; s=arc-20160816; b=hR8ZF6D1xosJO+gMr3K/R91Hj+VELwwOFsvWTfAlv+cGir/Ap68JjyjLxbaZLFeHCe rzhUYqU7rTxLa4r+dG/g6niEdVLnA5IDwFK2MtzdIfiLbvlPlwb7tEMLmFIKcLanDXxz re52VIHCjzDm2+P3wiXcJ/WP9FUr1ixhFcWdZqiuAk/wJiGK2eFzqOk58QhG9792j9Dl i4gFWfLZq2BVd9EdYKV/FO0BVR8r6LdSyubnY23ZGsEhPlRq9xVXOhRCJPfb4yFOyLbk 7vdzoOJi3cZUMYpnGrdR0wRshnC2Y7WNTm8mWPP/I6l+3h8h5WfLv4uUfouyR8a1faTV SlDA== 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=QZ6jW04N3uwN6cb1lWj05UXwh7wwrtHU2hFkvJlsRfK01di4ZPzAbc3slMgKTP+bf5 x2UuJtw0mJUtBBl/t0KqP5oLoBAjnugTOicYz41Me/47pdIRFhyAJnTcQCHbnQJAa/Ax Wn71ivOu2Fj9swlZzhUhXmkVvNh78LNtTlDQHf4KqFakljR8dkZAQkzH921Q9ijW9jan 9WrSrn5zl9H6egh9V2FbrTaCVGdWFyyRNZU8SIkLkLVfFRSLopqpecII+0xIeimtftpD MDXSPDWL5aR2pgIPZdpk8T2CQEAfhVdmkulx7YVkVAFhJcy/PHGBPKGkEEEhapCYhmTP O7Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="19lNW/oD"; 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 i16si14837831iow.64.2021.05.24.09.01.37; Mon, 24 May 2021 09:01:52 -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="19lNW/oD"; 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 S235972AbhEXQCa (ORCPT + 99 others); Mon, 24 May 2021 12:02:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:40480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234811AbhEXPzz (ORCPT ); Mon, 24 May 2021 11:55:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DEA6F61441; Mon, 24 May 2021 15:42:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870944; bh=w8AofuxdJMLE8NjVCLMel5ry4/86pey5fHiGwP8Fn14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=19lNW/oD/tFZl93IyRNmun+z98zZp6ZSacMrJHR1yLV2fN3BVzKKzdmxJxXPPZZFm 1ub+ck4f2evJSZuRJt/XSpUQ6rB9jNtvIwFvAQ8vUkNKSEbmHlG1D+zokZgmUE+QjR B0Tj2jxw/ycpK5ZPD+zP6s7WkVyF2E47o3XcoPdc= 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.10 090/104] net: rtlwifi: properly check for alloc_workqueue() failure Date: Mon, 24 May 2021 17:26:25 +0200 Message-Id: <20210524152335.833159627@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152332.844251980@linuxfoundation.org> References: <20210524152332.844251980@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);