Commit 455832d4 authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed

net/mlx5: DR, Fix check for unsupported fields in match param

The existing loop doesn't cast the buffer while scanning it, which
results in out-of-bounds read and failure to create the matcher.

Fixes: 941f1979 ("net/mlx5: DR, Add check for unsupported fields in match param")
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 9091b821
...@@ -924,12 +924,13 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher, ...@@ -924,12 +924,13 @@ static int dr_matcher_init(struct mlx5dr_matcher *matcher,
/* Check that all mask data was consumed */ /* Check that all mask data was consumed */
for (i = 0; i < consumed_mask.match_sz; i++) { for (i = 0; i < consumed_mask.match_sz; i++) {
if (consumed_mask.match_buf[i]) { if (!((u8 *)consumed_mask.match_buf)[i])
continue;
mlx5dr_dbg(dmn, "Match param mask contains unsupported parameters\n"); mlx5dr_dbg(dmn, "Match param mask contains unsupported parameters\n");
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
goto free_consumed_mask; goto free_consumed_mask;
} }
}
ret = 0; ret = 0;
free_consumed_mask: free_consumed_mask:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment