From: Dan Carpenter Date: Fri, 3 May 2019 12:28:39 +0000 (+0300) Subject: net/mlx5: potential error pointer dereference in error handling X-Git-Tag: Ubuntu-5.10.0-12.13~4941^2~125^2~24 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6cc070bdf07c8f6d5955d43da0560c9e5fd203b1;p=mirror_ubuntu-hirsute-kernel.git net/mlx5: potential error pointer dereference in error handling The error handling was a bit flipped around. If the mlx5_create_flow_group() function failed then it would have resulted in dereferencing "fg" when it was an error pointer. Fixes: 80f09dfc237f ("net/mlx5: Eswitch, enable RoCE loopback traffic") Signed-off-by: Dan Carpenter Signed-off-by: Leon Romanovsky --- diff --git a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c index 86f77456f873..401441aefbcb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c @@ -106,10 +106,10 @@ static int mlx5_rdma_enable_roce_steering(struct mlx5_core_dev *dev) return 0; -destroy_flow_table: - mlx5_destroy_flow_table(ft); destroy_flow_group: mlx5_destroy_flow_group(fg); +destroy_flow_table: + mlx5_destroy_flow_table(ft); free: kvfree(spec); kvfree(flow_group_in);