From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02C5515ADB for ; Thu, 22 Jun 2023 05:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B843CC43391; Thu, 22 Jun 2023 05:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687412879; bh=5fRzPBaLD47oCM4ckux7SngdwTLmWgcBxCz/EuqHn9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nxclcofoKIKITbogIvIEjnGdiz+Ad5ejZh+Pep2fvpToUe+n2SDqndYF0HVQqKPR6 p86tjElDondzmmYW7YPFEVSFztUGbDbMFpg/gGvAbDw7nzEc8N7iwJJG5dQNzOvcSu DX3uQhezx4HCQVk1SnJ+YRwJt5DTeV84gUZItmqqwB73y0EnSTe1vZeMXNOXNU8sKx d7GCGyZ1iLcwyRQW7J5AFqGcnbWq/5qhuTQQb3D/LHVnEm2rDLBPHTair27lIPrIKw QfeWBj36mcq5sX7tfJPiWuaaQjLXDrOC/RzblNHxLhZt6r6AexI7pMf8eR/wbrfuxR qnJUvWgrYEt8g== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Roi Dayan , Shay Drory Subject: [net-next 11/15] net/mlx5e: E-Switch, Fix shared fdb error flow Date: Wed, 21 Jun 2023 22:47:31 -0700 Message-ID: <20230622054735.46790-12-saeed@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230622054735.46790-1-saeed@kernel.org> References: <20230622054735.46790-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Roi Dayan On error flow resources being freed in esw_master_egress_destroy_resources() but pointers not being set to null if error flow is from creating a bounce rule. Then in esw_acl_egress_ofld_cleanup() we try to access already freed pointers. Fix it by resetting the pointers to null. Also if error is from creating a second or later bounce rule then the flow group and table being used and cannot and should not be freed. Add a check to destroy the flow group and table if there are no bounce rules. mlx5_core.sf mlx5_core.sf.2: mlx5_destroy_flow_group:2306:(pid 2235): Flow group 4 wasn't destroyed, refcount > 1 mlx5_core.sf mlx5_core.sf.2: mlx5_destroy_flow_table:2295:(pid 2235): Flow table 3 wasn't destroyed, refcount > 1 Fixes: 6704fef92002 ("net/mlx5: E-switch, Handle multiple master egress rules") Signed-off-by: Roi Dayan Reviewed-by: Shay Drory Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 612be82a8ad5..cf58295ad7e2 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2618,8 +2618,12 @@ static int esw_master_egress_create_resources(struct mlx5_eswitch *esw, static void esw_master_egress_destroy_resources(struct mlx5_vport *vport) { + if (!xa_empty(&vport->egress.offloads.bounce_rules)) + return; mlx5_destroy_flow_group(vport->egress.offloads.bounce_grp); + vport->egress.offloads.bounce_grp = NULL; mlx5_destroy_flow_table(vport->egress.acl); + vport->egress.acl = NULL; } static int esw_set_master_egress_rule(struct mlx5_core_dev *master, -- 2.41.0