Commit 6cc64770 authored by Wentao_Liang's avatar Wentao_Liang Committed by Saeed Mahameed
Browse files

net/mlx5: DR, fix a potential use-after-free bug



In line 849 (#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: default avatarWentao_Liang <Wentao_Liang_g@163.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent f9d196bd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -846,9 +846,9 @@ dr_rule_handle_ste_branch(struct mlx5dr_rule *rule,
			new_htbl = dr_rule_rehash(rule, nic_rule, cur_htbl,
						  ste_location, send_ste_list);
			if (!new_htbl) {
				mlx5dr_htbl_put(cur_htbl);
				mlx5dr_err(dmn, "Failed creating rehash table, htbl-log_size: %d\n",
					   cur_htbl->chunk_size);
				mlx5dr_htbl_put(cur_htbl);
			} else {
				cur_htbl = new_htbl;
			}