Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3536371pxj; Mon, 24 May 2021 08:54:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpg3iEl8NesYnADV4S7MTn9VFcbMlh2RTJMz5/XHxkKSqxiW2LDhSAt79yjIVWa0rQVeOO X-Received: by 2002:a05:6602:2b84:: with SMTP id r4mr16684501iov.206.1621871664901; Mon, 24 May 2021 08:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621871664; cv=none; d=google.com; s=arc-20160816; b=F87b303cPcBmA5aapvoyuGKMbeb+NVBz0KancnOSB/5/hmnUyYxVW4wO+9fJ3VpvCE 1KA03R8WEiQAG+Bi4hBc/1W7PkYT8OI9dtmIGwlMphgkaVKR8X9Kg5kAMecJCPLGE7Ro 3FCdNJLk2u7aWL17sJb08NW63f2OmE6QyYkJCQKlqoq5FhNVBJXsRlAsgTFgl2HTKcLk hQcoT3o/jpWMZI6R25zzm8PHvW+v2XD6rjH9edapSBtvs2+QwEliP6C5CuFV05s+dK1Y OQ5iRANKZhtxrJHCtikb8EffCYL4R3y6E/mMhWIwHE+0mBiKUhRZiNAlsSGQDsTguUXd FMkQ== 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=701CFuoOoukPMaD+JCqePeEWjhqmZlvgFOAm4RVvJQE=; b=G1YBquEJZvWQmi9T4V44BYxA8oniNPZLBPBSLz9nVtyZ4gMYw+m60/21v0dYkPtP26 gZBYF3fasbOXruFAbduKhWnpbz12uS/r1W3+8ffq1KA50e2TnKH9xBIGQXnD4Ex7Nhl0 0oU2wQGqwMABg3ttr9yhJQS1+Enj+GBKLmRX9+12dS4Kbbf0eLXoA9psmIlBx1yA4CFn opE7AOBA+UtLEnQlsYd+xrKGbBzgmdhqS52Np+lQXfLCtWJZgwGOiWM6pRFEBhAFUDLa a3UIPUVWT/J5SfqEd0Kcm5Cm4bRJitu2y27nfg7vKY25cgMLjgLwv2St/KkKn0qycUZv NV7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1bNzlxQh; 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 h17si2170870jas.28.2021.05.24.08.54.11; Mon, 24 May 2021 08:54:24 -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=1bNzlxQh; 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 S234921AbhEXPyy (ORCPT + 99 others); Mon, 24 May 2021 11:54:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:33924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234621AbhEXPo0 (ORCPT ); Mon, 24 May 2021 11:44:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DE941610CB; Mon, 24 May 2021 15:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870560; bh=whJASy/Sx2Insa/dLhAMDdtHfrCkejGVJIwkkD7qiqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bNzlxQhXmuLUPR3W+0n5yHd55gBE7bnW3fuFp95uXP8I2N0pEkAKsHrGlAqHJPUv wke/uuCar8F98hN9hdR4SSzSuL1BtBXfUp38dtQ7U/O4D7md9oxgzToZiOm2cGNLwQ hJnCfspNRfBVAMWZPuSOPlaVeQN4M2mYdyCu1jsQ= 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.19 42/49] net: rtlwifi: properly check for alloc_workqueue() failure Date: Mon, 24 May 2021 17:25:53 +0200 Message-Id: <20210524152325.727974171@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152324.382084875@linuxfoundation.org> References: <20210524152324.382084875@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 @@ -457,9 +457,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, @@ -468,7 +473,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, @@ -481,7 +487,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) @@ -581,9 +587,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);