Skip to contentSkip to conversation

net/mlx5: potential error pointer dereference in error handling

PATCH In review Dan Carpenter 2 participants 2 messages May 3, 2019 – May 28, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/ethernet/mellanox/mlx5/core/rdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/rdma.c +2 -2
index 86f77456f873..401441aefbcb 100644
@@ -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);
Signature · 1 line
2.18.0
#1 lore raw
Quoted 9 lines · Dan Carpenter

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")
---
 drivers/net/ethernet/mellanox/mlx5/core/rdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Sorry for the delay, applied to mlx5-next branch.
6cc070bdf07c net/mlx5: potential error pointer dereference in error handling

Thanks