Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13016614rwl; Wed, 4 Jan 2023 02:13:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXuZeoyNLqlVK3XC5Wau6v96W/hLtURrJkWYE3K7rFPJSq4AbKLK61Y7Q1RB50KYmNLSP265 X-Received: by 2002:a17:906:144a:b0:78d:f455:b4d5 with SMTP id q10-20020a170906144a00b0078df455b4d5mr41544065ejc.60.1672827239081; Wed, 04 Jan 2023 02:13:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672827239; cv=none; d=google.com; s=arc-20160816; b=x0Dn2Z6WR8BxSCaVaZR3ty6h4Sm07thqqGLkMMZMKxV53I4491BckqI678qO/ex6Gw x9GR3oHdV+SlUSVY4fC2wETFp9N9Z0hO8cCTOLFPdAb8ep+Ln1UpcZfr8mZQweLsUjrS m4q3qcbqUGIBhClUr/yXkHXdWskFpe8iWTAZlIBET9PCFtdCx+uXjPfaR02A/mOOyIOL Xj7QF+ZhQ1OT8E4Tcf71MB0/CX/FV5oqVth16GC6qYhrSrdTKex9D3TEuUg7OXkImVgd CBD1S9yXp2EqmUYv/wWRYwVueaB3Mg0Cc07utk8OuqV2ak+V6uGeO4VwzKVfJWS3EaIl 3JSg== 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 :message-id:date:subject:cc:to:from; bh=+8DYvre9ZHPRou86EhTFNigjl5eyZMtjAHfaYu3WM0k=; b=0085/qu5jn7L3GcUsv/gY2v2QOzEJvSYvo2pa6PZwtwExNIkWFlnrbw/sAhBMJFXN+ y5fjHrFanBFaoNnxjdnf+wYytD9ZdwxfLaePk9EdPt3M45t4sVVjF6/hNtPNWPL5R4ih PsoRZtgdksDHtqs3DLr/b6eI6uNeo2UkcRvhpqmsBeWPxPbVygNWSrBs18WNAjZlb/z7 zXniqztBrbY7VJh645h+A5IW0HAn/fVUad0qMCG4FStY93eCUvHlAEZPdSqo6Wi9heGJ XiTRMkXv/ebZDgW4QHbjswD5mtA/vRZ5WNI53/iTpKX6K3mY9G9o9PZzfR5Xj31iZ0GH XAxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb3-20020a170907070300b0084c71a2cbdbsi21037892ejb.214.2023.01.04.02.13.45; Wed, 04 Jan 2023 02:13:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233733AbjADKBP (ORCPT + 57 others); Wed, 4 Jan 2023 05:01:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231288AbjADKBO (ORCPT ); Wed, 4 Jan 2023 05:01:14 -0500 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E4DCABCAA; Wed, 4 Jan 2023 02:01:12 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-03 (Coremail) with SMTP id rQCowABXX5dcTrVjC5xuCg--.34318S2; Wed, 04 Jan 2023 18:01:01 +0800 (CST) From: Jiasheng Jiang To: gregory.greenman@intel.com, kvalo@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, luciano.coelho@intel.com, johannes.berg@intel.com, shaul.triebitz@intel.com Cc: linux-wireless@vger.kernel.or, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] iwlwifi: Add missing check for alloc_ordered_workqueue Date: Wed, 4 Jan 2023 18:00:59 +0800 Message-Id: <20230104100059.24987-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: rQCowABXX5dcTrVjC5xuCg--.34318S2 X-Coremail-Antispam: 1UD129KBjvJXoW7trW5try7Xw4kZFW7ZF17Awb_yoW8uFyDpa nxuryjqFW5tw1jqFyrGFWkZas8Ww1UJr1DGFZ2gw45urn7Aw1rJa10gryYqFykGry0gr15 CrWjyF15Wr4DXrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvj14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r4j6F4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWU JVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfU5s jjDUUUU X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add check for the return value of alloc_ordered_workqueue since it may return NULL pointer. Fixes: b481de9ca074 ("[IWLWIFI]: add iwlwifi wireless drivers") Signed-off-by: Jiasheng Jiang --- drivers/net/wireless/intel/iwlwifi/dvm/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/dvm/main.c b/drivers/net/wireless/intel/iwlwifi/dvm/main.c index a873be109f43..b490a88b97ca 100644 --- a/drivers/net/wireless/intel/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/intel/iwlwifi/dvm/main.c @@ -1048,9 +1048,11 @@ static void iwl_bg_restart(struct work_struct *data) * *****************************************************************************/ -static void iwl_setup_deferred_work(struct iwl_priv *priv) +static int iwl_setup_deferred_work(struct iwl_priv *priv) { priv->workqueue = alloc_ordered_workqueue(DRV_NAME, 0); + if (!priv->workqueue) + return -ENOMEM; INIT_WORK(&priv->restart, iwl_bg_restart); INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); @@ -1067,6 +1069,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) timer_setup(&priv->statistics_periodic, iwl_bg_statistics_periodic, 0); timer_setup(&priv->ucode_trace, iwl_bg_ucode_trace, 0); + + return 0; } void iwl_cancel_deferred_work(struct iwl_priv *priv) @@ -1456,7 +1460,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, /******************** * 6. Setup services ********************/ - iwl_setup_deferred_work(priv); + if (iwl_setup_deferred_work(priv)) + goto out_uninit_drv; + iwl_setup_rx_handlers(priv); iwl_power_initialize(priv); @@ -1494,6 +1500,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, iwl_cancel_deferred_work(priv); destroy_workqueue(priv->workqueue); priv->workqueue = NULL; +out_uninit_drv: iwl_uninit_drv(priv); out_free_eeprom_blob: kfree(priv->eeprom_blob); -- 2.25.1