From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEE76C433E1 for ; Mon, 1 Jun 2020 18:47:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4ED0206C3 for ; Mon, 1 Jun 2020 18:47:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591037227; bh=hZIl8HhpXr2T0lEfT1MwgUu/hWaY6fD5sNyjG0yLeQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DOlGvEM+nCphqcgPBA0Z2cekq86J4CHdsRl2y54CbicCss40kGFqCtbTjOuGaXzEo ujKZJWIdkni64vhTDbWLYWg7diUfDSPccoPTJeos+V8zEplqDE3xnMFHram5vIS0Vu KGDhoRLP5xm6dc5nyzVZe2dhZ31KN0TlnOV1ifoA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729995AbgFASI1 (ORCPT ); Mon, 1 Jun 2020 14:08:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:54550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729371AbgFASI1 (ORCPT ); Mon, 1 Jun 2020 14:08:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A72D20C56; Mon, 1 Jun 2020 18:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591034905; bh=hZIl8HhpXr2T0lEfT1MwgUu/hWaY6fD5sNyjG0yLeQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IbyTew1Ax6efzzP1G5rNhENZXvlZxmqbcSGAhNnyFLb/lu3chxxnK79JtrbK6x/Hr h2MA7MEp9uYgJp8Ir5S6nieDo2mOq9HC8LGYMvmaSv0LSai8OU0iPKwb+wXIb63gU2 ZSrBDgtfPn4z9ikVQSkt8svQ9OwtWa6l9Wakq/Ds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shay Drory , Moshe Shemesh , Saeed Mahameed Subject: [PATCH 5.4 025/142] net/mlx5: Fix error flow in case of function_setup failure Date: Mon, 1 Jun 2020 19:53:03 +0200 Message-Id: <20200601174040.439377655@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601174037.904070960@linuxfoundation.org> References: <20200601174037.904070960@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Shay Drory [ Upstream commit 4f7400d5cbaef676e00cdffb0565bf731c6bb09e ] Currently, if an error occurred during mlx5_function_setup(), we keep dev->state as DEVICE_STATE_UP. Fixing it by adding a goto label. Fixes: e161105e58da ("net/mlx5: Function setup/teardown procedures") Signed-off-by: Shay Drory Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -1183,7 +1183,7 @@ static int mlx5_load_one(struct mlx5_cor err = mlx5_function_setup(dev, boot); if (err) - goto out; + goto err_function; if (boot) { err = mlx5_init_once(dev); @@ -1229,6 +1229,7 @@ err_load: mlx5_cleanup_once(dev); function_teardown: mlx5_function_teardown(dev, boot); +err_function: dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR; mutex_unlock(&dev->intf_state_mutex);