Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3539449pxj; Mon, 24 May 2021 08:58:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoOhQhakWYXUSBvHvtmgIHYmOwX6lQgjk3HF/kHcJo+016YszqwOvKNgvrJrgV7XRp+M+Z X-Received: by 2002:a05:6e02:789:: with SMTP id q9mr18535217ils.292.1621871909978; Mon, 24 May 2021 08:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621871909; cv=none; d=google.com; s=arc-20160816; b=LCaMQQjwee3S3j3fniJIyQKqcg0wBjgmBBcUZc+J+/slbSQx7ZC74CyCAAKNvjtk+P TcFzTxeFxU8J91K/HSzvIGGjH6mMBzOwUaLo8fI+lMftcbjvMJLyRhGcu4uhTbyjQTEA Q45240+Cd1S5TY9+Vn5wwbr10YOq2pf04uKqbf7IqHk1T+VxiaKnC6Ud1wMjOX5dLLhd bM8EZF2Hlf5TPAjA720nVRCxGJHIHCM7Pofl8sAjWrB8BcQRi8qZ4DklHAoCLUkhTWZk 3h4su/ovK+P0iBcKvzK1un/eGFmmegC+WehCRxBwmcDm0hI6iK0XFsI5+TVSfJWZneCJ R/JA== 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=BvM76w0TigZ4dhr2OmUutKrEqNhYk0Wty9nHC48pTcU=; b=wrE+7+F1m3olKbiP3TTE13gDKHu7Ac6b7BRKFwDQqB26N7/VkR/PGu0GCwD3iniyvq I2Pb6P90MkKmpfRR3NhP1PAo0eDZQQ65Beg7nTse+VbdflaEjmyJXG5Xa7NHOWKAbBvL jVxgWr8YjQaVDWZFJRNLL0MDU8kmujEBSD1rtIM+C6Z6Sb6vULm+oqz5YirCJPqTcD7a MaZ33eBBqJpgV6nHFHSKBDBvqEwnoxo+/iqjkotY6nOAJyF0v9TFY3Wr6ipaaA5NFhiJ FmE0bEQSyfs8rq6FYUFizeUC0ZQQk2umjFWaW10nloreZn8eGZo6/TXp9P5Rxy1+DQzE awqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="AbLcMc/1"; 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 h13si6684295iop.97.2021.05.24.08.58.16; Mon, 24 May 2021 08:58:29 -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="AbLcMc/1"; 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 S233739AbhEXP6A (ORCPT + 99 others); Mon, 24 May 2021 11:58:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:38584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234257AbhEXPvw (ORCPT ); Mon, 24 May 2021 11:51:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BDECE6162D; Mon, 24 May 2021 15:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870723; bh=dxBIgUZ1Idl+2yCCxvP+acIItyl3e/AKF/qtoTpLeMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AbLcMc/13pAeMj7P4410VbxWz3T9CUs25xkCmjzLeUcy4Nt9GmW+fRBLaUhTCnvMF K/bXlj9KQIhJm0LRv3UDurD4rPNdY+s5qavwJsLp1fFyW1uNIhovUdQxb9BjXQCkvJ DUeOh0OMCSCvRWhUtg/KQgY35d4gdljFtre6wvYg= 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.4 61/71] net: rtlwifi: properly check for alloc_workqueue() failure Date: Mon, 24 May 2021 17:26:07 +0200 Message-Id: <20210524152328.434681042@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152326.447759938@linuxfoundation.org> References: <20210524152326.447759938@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 @@ -436,9 +436,14 @@ static void _rtl_init_mac80211(struct ie } } -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, @@ -447,7 +452,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, (void *)rtl_watchdog_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, @@ -460,6 +466,7 @@ static void _rtl_init_deferred_work(stru (void *)rtl_fwevt_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, (void *)rtl_c2hcmd_wq_callback); + return 0; } void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq) @@ -559,9 +566,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);