Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp668403ybg; Mon, 1 Jun 2020 11:12:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW+1yKUAK0cJcNJ+RrXzJ/alZrh0/aoPE2HMVR5XyaDmr3kHQi1GqugZXh6zmA0Ppu97Gc X-Received: by 2002:aa7:d1d9:: with SMTP id g25mr23133066edp.301.1591035170289; Mon, 01 Jun 2020 11:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591035170; cv=none; d=google.com; s=arc-20160816; b=ObU7NawAWpuBKbN4HpTWWT8GSO59++Uh9unNuLTAovOaq9Sb/zo2Ruzw7PSmfBaZJ5 ORdMa8HaCAGHrffM8lUKVm3J+7jXpTLbsWZxwZgPiwzYIOjUuJsJI0J+4MZs8B5kBAkz aZg+UQ/so4Wf7AhnIO7hDkzQVClaSnfZRzyeZHtoags88EQq+DG4NpQWecgF/hnQRtdE XNQ+hUNgNnO5XcKUNQxP8GLabajVYM1Az5ZdYbzCAmEcfMEL8zzn5QfbqNfHcg80cMgn rMJBggO+2KPyrNF+xCMdrOOLeTNbUjB+hjJuGHMstEmzg8Kb4Bzsxv/uMBSH520Z2dAH NRkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OnikIn5cerOhKJh2pc3LmFdtyiTyWIWNceHR7TTAUI4=; b=e/i8o5cYiaEUsGyMAIyhVqGeYUaCyZ/QJ8p3Bw4F597k2ONE8RDkwBaxnNPboWS915 PEpT9v03K8ZwzOGSrDJ3eeIhyhovjyX/qafn22yTYzc8BU9kzfUN7RyP3ykJ845h2OGv 5aBmRE56PDl0B5RWsmtcLZ+pMnMpGPyJnmSu67s5On0vSlDplQDAhsKcwWjBBSrdi0OZ jqETmWE/rWEq9LBZiTMsU5cXyZC5jx7/XdbZh4AK4qBPkfErlD0ntwWKqjsOAAaBAT+i rRlQJ5wTYJG2K6tHyI25hsXJuHb1TkTqyDymcVyABC3g1ydmwUPn7odqv10dpzp+G9ud o1GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IbyTew1A; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si134911ejz.632.2020.06.01.11.12.26; Mon, 01 Jun 2020 11:12:50 -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=@kernel.org header.s=default header.b=IbyTew1A; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730737AbgFASI1 (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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);