Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1620252ybv; Fri, 21 Feb 2020 00:25:46 -0800 (PST) X-Google-Smtp-Source: APXvYqzLd6BGHq1xr89EAvpbknkS3zVisjSVM6wn3tvsrUPrdlBXHlBoTO1fgAwhOAD/vs9eSwR3 X-Received: by 2002:a9d:4c92:: with SMTP id m18mr25888475otf.168.1582273546598; Fri, 21 Feb 2020 00:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582273546; cv=none; d=google.com; s=arc-20160816; b=iIPlXCDr7bab9S6npjEeGYygYO505tnA3KctV+gKG5zaYWaA0U8jGTPYVQoB4bmhIO dRBBlu4cIHfw2Ch0U7ChoKc3VRUno4ozOYqx5NUSl3AeL7fs6Q16qeZCAdZIeUhrCcFP f7U/92u/lWrHQU2Wzgawf5wSaCYJVV26DK+xdUIl6EX3ATf3ByUifydN/6+tUC0fdZOI ZeYsi4UXxWK+EMMCndoPprShobcbDAWj0DLVlXrdPpRHAux7ITFQW3/dPSTCqSbaG9cC feKaBnxN81huOyAgk2FI3gEVlS/8Ih+TqZzulboeCwUxQnAcidXYL1Fao4fpKA4dL7Wn YNhw== 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=ZAVTxSIDpoCzdHzBrlo8nr8q4bVWsRlS479IHdlQ0Jg=; b=dR8KumnFd7tfV7IkwkDuGYsmaOYCe2z2K80BfAkijZISgpEMiSdJ+251x5gJQF28hx SBbikzZFcx040QYN699+d7/57fvW51YCzBs80/WmAKtc3qo68g4qZm6IAf3AzBkPILDM VQceb17ixK7g+H4iRLLvLjb0VfeymJnf1ZeYWpf5Zg1zau7TbfyaGnOh5L0XDxPNYMra MR9TL+ClVhlqcFTG5k4mtZLmijenl15kmrDeYtYM8nKKICGIgiccacMwcBphIUxbjfnO A10hVUYTKBzZpf8RAmpZwTC8Zdz5M/QyJUt/hYxScjqAE2r1HOQnEOiC/X5FJzw/2TuY ZCHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dRP17P6m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si1167822otn.117.2020.02.21.00.25.34; Fri, 21 Feb 2020 00:25:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dRP17P6m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388296AbgBUIY5 (ORCPT + 99 others); Fri, 21 Feb 2020 03:24:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:37450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388701AbgBUIYv (ORCPT ); Fri, 21 Feb 2020 03:24:51 -0500 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 C4BF22469F; Fri, 21 Feb 2020 08:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582273490; bh=aQ13InXuDpar2cd6CHyUskGNh56VoOHnMUw7soM1Lno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dRP17P6m5X7TMq0Sku/cgT/5pqcjFXFyCtCc8b6ikQUHWl9sg1vbmvxoSGaBiNmL3 13q1VgGYo6dNpj7mKX4+RzOXw1Zjr89qmNTXQQanma0COU6cDMLFFdAqc9Vp+o6llk CWvdb0/6RPk4k3T17zTqWlVjE4jdKYzPcD5RfJII= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 190/191] mlxsw: spectrum_dpipe: Add missing error path Date: Fri, 21 Feb 2020 08:42:43 +0100 Message-Id: <20200221072313.575255690@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072250.732482588@linuxfoundation.org> References: <20200221072250.732482588@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: Ido Schimmel [ Upstream commit 3a99cbb6fa7bca1995586ec2dc21b0368aad4937 ] In case devlink_dpipe_entry_ctx_prepare() failed, release RTNL that was previously taken and free the memory allocated by mlxsw_sp_erif_entry_prepare(). Fixes: 2ba5999f009d ("mlxsw: spectrum: Add Support for erif table entries access") Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c index 41e607a14846d..4fe193c4fa55d 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_dpipe.c @@ -215,7 +215,7 @@ mlxsw_sp_dpipe_table_erif_entries_dump(void *priv, bool counters_enabled, start_again: err = devlink_dpipe_entry_ctx_prepare(dump_ctx); if (err) - return err; + goto err_ctx_prepare; j = 0; for (; i < rif_count; i++) { struct mlxsw_sp_rif *rif = mlxsw_sp_rif_by_index(mlxsw_sp, i); @@ -247,6 +247,7 @@ start_again: return 0; err_entry_append: err_entry_get: +err_ctx_prepare: rtnl_unlock(); devlink_dpipe_entry_clear(&entry); return err; -- 2.20.1