net/mlx5: potential error pointer dereference in error handling
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 3 May 2019 12:28:39 +0000 (15:28 +0300)
committerLeon Romanovsky <leonro@mellanox.com>
Tue, 28 May 2019 14:35:06 +0000 (17:35 +0300)
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 <dan.carpenter@oracle.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/rdma.c

index 86f77456f873484742b2efef9919611f2fcf5f96..401441aefbcbc3b885a458c590c18f72a422b60b 100644 (file)
@@ -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);