Skip to content

Commit a1919d8

Browse files
Aleksandr MishinSasha Levin
authored andcommitted
net/mlx5: Fix tainted pointer delete is case of flow rules creation fail
[ Upstream commit 229bedb ] In case of flow rule creation fail in mlx5_lag_create_port_sel_table(), instead of previously created rules, the tainted pointer is deleted deveral times. Fix this bug by using correct flow rules pointers. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 352899f ("net/mlx5: Lag, use buckets in hash mode") Signed-off-by: Aleksandr Mishin <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 14d1eb6 commit a1919d8

File tree

1 file changed

+6
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/lag

1 file changed

+6
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/lag/port_sel.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@ static int mlx5_lag_create_port_sel_table(struct mlx5_lag *ldev,
8888
&dest, 1);
8989
if (IS_ERR(lag_definer->rules[idx])) {
9090
err = PTR_ERR(lag_definer->rules[idx]);
91-
while (i--)
92-
while (j--)
91+
do {
92+
while (j--) {
93+
idx = i * ldev->buckets + j;
9394
mlx5_del_flow_rules(lag_definer->rules[idx]);
95+
}
96+
j = ldev->buckets;
97+
} while (i--);
9498
goto destroy_fg;
9599
}
96100
}

0 commit comments

Comments
 (0)