Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3526012pxj; Mon, 24 May 2021 08:39:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUR39TWVbv2by4Q+9ZMnmxJCBO6baZ1geuuEg7bb9/03J9E/Hw0a3wE7PLVvtMffLqA73T X-Received: by 2002:a17:906:454b:: with SMTP id s11mr23714352ejq.3.1621870797726; Mon, 24 May 2021 08:39:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621870797; cv=none; d=google.com; s=arc-20160816; b=UxY74QAQDBToTEX7bJA+gd+swbZ0OlSV7gAdw7wQIZ1Ztn3AvJCVX4mh2wtQj0kSOp IW6ehIfi3W7gTrhlLlWgjEsA245KvD5NcsWTQVdXmu9jmeFEWaZjD6DvRzDbx3A9Ok82 Agwbeyjry39kpL5b3uzG2IwWYXpjMGXn6DgpLBF3q64BR7ji1Q0GjqIOmxRYU8VqI7C3 4UuRiI8CIrlAux49ylQ+FQhV6QMJqfOYrFmwGHJ1dkcIJMxWQQWpuW6mOnja+d8H5plc he+sL7jI2OMv9wJxGI2GMKRn5H+9KhSNWVG7PYjFZLmps51LANmcOhJKs9PsjlWqVHxL UG9Q== 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=ujqxeqydsqaOV21eQvLL9X8/7ivlKTsNknkugzhvNvI=; b=O5AJ5GSqVIsPy44/KUAIHiKsWKTKryjtnN0pxd6VpsDy0gFyXsCY+SZ4xjpD5dkEtD r2DpZN84/u5RwEwPfUPfAkGOGeUom2C89lYmJAJ1sNaBhcw3uoBJSWJdB7EGE+XfRA3u 12mAHajOgMiFOkb8V10RVj0lQoQ8+saRfIB458z3RmKcTlSFejBSwkCP3ER2bS2F1rD/ 4uXTQm1dysx5QTMitcq8DLq635Cpw0bSgw8ZS75f/EUsY3F2XqdQ1BSUoVIfzJv/ZycD xCIq7Wlur5nQ27r9O2wtQRIpFfWQ5GI0gcHdHIqIHKzxbEQlX7FDy0IcxllKo37e6sPN NfRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bRw0wwKY; 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 t6si11673514edd.419.2021.05.24.08.39.34; Mon, 24 May 2021 08:39:57 -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=bRw0wwKY; 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 S233284AbhEXPkL (ORCPT + 99 others); Mon, 24 May 2021 11:40:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:51512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232803AbhEXPgy (ORCPT ); Mon, 24 May 2021 11:36:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D96B361411; Mon, 24 May 2021 15:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870377; bh=S1CN5MyHtZ9OSrpusCrkNbNf9yJ1kB5dvIQ0K/iCqlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bRw0wwKYsPgh2M/iVQ+SYHn3eX39zA5ebd7fJ/9lPo7YTmTi3bFfdmCSUBmQtyc7q nmMi8rGfdNXt67b2TM5w8UZGjx7ncqHexMv50p08SZtehrchHirGWsfQx5KZL34L0H gM97PjxKhbipYfuLcy1HJKL5Q2a1B8sSYRF4AZHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kalle Valo , Bryan Brattlof Subject: [PATCH 4.9 29/36] net: rtlwifi: properly check for alloc_workqueue() failure Date: Mon, 24 May 2021 17:25:14 +0200 Message-Id: <20210524152325.101577356@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152324.158146731@linuxfoundation.org> References: <20210524152324.158146731@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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/realtek/rtlwifi/base.c +++ b/drivers/net/wireless/realtek/rtlwifi/base.c @@ -454,9 +454,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 */ setup_timer(&rtlpriv->works.watchdog_timer, @@ -465,7 +470,8 @@ static void _rtl_init_deferred_work(stru rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); /* <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, @@ -476,7 +482,7 @@ static void _rtl_init_deferred_work(stru (void *)rtl_swlps_rfon_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, (void *)rtl_fwevt_wq_callback); - + return 0; } void rtl_deinit_deferred_work(struct ieee80211_hw *hw) @@ -568,9 +574,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);