Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3106740rwa; Mon, 22 Aug 2022 21:45:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR731a+ymKOXKAfDWY9G41PTluxmTjZIx3ip2QQiQ08jnDm53X++EraM1HqLAG42zFeJ31mA X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr15426865ejb.426.1661229922783; Mon, 22 Aug 2022 21:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661229922; cv=none; d=google.com; s=arc-20160816; b=Ix1xhwHABPjtoZoEO/QpLDP6y85Hv5EPLtq6/bIwOrQqIH4IDqbMD99IjsjCdJhs2O c2NHmTxjsbbFDqQOR07xopejLt4XT9hYVEonNC0/XaHp8QxP+2aS5IMoHelURE3NHukh qOjw7XxxKe9vnEJeuLCORKYSNhjSukL3kK1QUqLRfwphyS+HNFLzrBaEIWFXALegvd0c olPGRuwU5HAmu9NJLHupH7T6WiAngcLTZieI5rHknOQ2ybxR3xm2yoE3n7L9V9zeaWBS J2oUaYgAf/tWl/RgZ9R5twS1sW1/OvIOaIPHi0y0OJ7dHpWAE2vaBWl+ZZrjRVk6KbMG dpyg== 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=8lzVDg4QQLa93knfi0CZlnb3ZRv1YDMZPK6Oxf0ZmAA=; b=C3BexE/LwACSW3RDC1RwTgJcEnog7xT38J2QCWwWq0hjGIjGblyiymw4u2jTIOs/Wg V9oWwH6eW4aHc/Y9GcLeyUBlUv1uUicRUyz1oFa4rSdKCRS9Ad3tFxvHAlF4OSgmdIxw Mtq1L6iDQ/Jru09vHe7kNiFiUxCvrjHh9rQztEoTrNw+912Ma2e1vbw9P0Qnu69I76gm KC07XO8niEF45IhJs7BRreb1Z9Dt1RY5yhvaOfe0CTQty3Dh4MLGzAgvblxhZw1Ujb0G vnYTzq+LXvlQjgIdGGJzzj16hKtAjAamGJWpBx7/1aqv1VHq/05e/ARbS+B6FcRAsTfO +djQ== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a05640235c200b0044660f40ed5si1410696edc.256.2022.08.22.21.44.55; Mon, 22 Aug 2022 21:45:22 -0700 (PDT) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239324AbiHWEel (ORCPT + 99 others); Tue, 23 Aug 2022 00:34:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231897AbiHWEej (ORCPT ); Tue, 23 Aug 2022 00:34:39 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A6C14E63A; Mon, 22 Aug 2022 21:34:37 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MBbrq15q7zkWMF; Tue, 23 Aug 2022 12:31:07 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 23 Aug 2022 12:34:35 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 23 Aug 2022 12:34:35 +0800 From: Yang Yingliang To: , , CC: , Subject: [PATCH -next v2] scsi: lpfc: add missing destroy_workqueue() on error path in lpfc_sli4_driver_resource_setup() Date: Tue, 23 Aug 2022 12:42:37 +0800 Message-ID: <20220823044237.285643-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 the missing destroy_workqueue() before return from lpfc_sli4_driver_resource_setup() in error path. Fixes: 3cee98db2610 ("scsi: lpfc: Fix crash on driver unload in wq free") Signed-off-by: Yang Yingliang --- v2: correct label spelling error --- drivers/scsi/lpfc/lpfc_init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index c69c5a0979ec..55a1ad6eed03 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -8053,7 +8053,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) /* Allocate device driver memory */ rc = lpfc_mem_alloc(phba, SGL_ALIGN_SZ); if (rc) - return -ENOMEM; + goto out_destroy_workqueue; /* IF Type 2 ports get initialized now. */ if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= @@ -8481,6 +8481,9 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba) lpfc_destroy_bootstrap_mbox(phba); out_free_mem: lpfc_mem_free(phba); +out_destroy_workqueue: + destroy_workqueue(phba->wq); + phba->wq = NULL; return rc; } -- 2.25.1