Skip to content

Commit 6cc6477

Browse files
Wentao-LiangSaeed Mahameed
authored andcommitted
net/mlx5: DR, fix a potential use-after-free bug
In line 849 (Rust-for-Linux#1), "mlx5dr_htbl_put(cur_htbl);" drops the reference to cur_htbl and may cause cur_htbl to be freed. However, cur_htbl is subsequently used in the next line, which may result in an use-after-free bug. Fix this by calling mlx5dr_err() before the cur_htbl is put. Signed-off-by: Wentao_Liang <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent f9d196b commit 6cc6477

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/steering

1 file changed

+1
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,9 +846,9 @@ dr_rule_handle_ste_branch(struct mlx5dr_rule *rule,
846846
new_htbl = dr_rule_rehash(rule, nic_rule, cur_htbl,
847847
ste_location, send_ste_list);
848848
if (!new_htbl) {
849-
mlx5dr_htbl_put(cur_htbl);
850849
mlx5dr_err(dmn, "Failed creating rehash table, htbl-log_size: %d\n",
851850
cur_htbl->chunk_size);
851+
mlx5dr_htbl_put(cur_htbl);
852852
} else {
853853
cur_htbl = new_htbl;
854854
}

0 commit comments

Comments
 (0)