mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 10:29:52 +00:00
net/mlx5: DR, fix a potential use-after-free bug
[ Upstream commit 6cc64770fb ]
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: Wentao_Liang <Wentao_Liang_g@163.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
4bbf0a9d90
commit
9c5c65ecbd
@@ -824,9 +824,9 @@ again:
|
|||||||
new_htbl = dr_rule_rehash(rule, nic_rule, cur_htbl,
|
new_htbl = dr_rule_rehash(rule, nic_rule, cur_htbl,
|
||||||
ste_location, send_ste_list);
|
ste_location, send_ste_list);
|
||||||
if (!new_htbl) {
|
if (!new_htbl) {
|
||||||
mlx5dr_htbl_put(cur_htbl);
|
|
||||||
mlx5dr_err(dmn, "Failed creating rehash table, htbl-log_size: %d\n",
|
mlx5dr_err(dmn, "Failed creating rehash table, htbl-log_size: %d\n",
|
||||||
cur_htbl->chunk_size);
|
cur_htbl->chunk_size);
|
||||||
|
mlx5dr_htbl_put(cur_htbl);
|
||||||
} else {
|
} else {
|
||||||
cur_htbl = new_htbl;
|
cur_htbl = new_htbl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user