The mlx5_flow_get_reg_id() function translates tag ID to register from the registers that are supported and available for use. The user does not know which register is available at a time and therefore there is an array that represents mapping to the available registers. Usually the free registers are continuous in the flow_mreg_c array but sometimes the mtr_color_reg register is between them and it must be skipped and the next register returned, in which case the function returns the mapping of the next entity in the array. When the function reads from the next entity in the array, it does not check whether such an entity exists and in some situation invalid access to memory occurs beyond the array boundaries. So, when all the registers are valid from HW perspective and the meter color register is not the default, the tag id 5 causes an out of bound access. Validate registers availability when meter color register is not the default. Coverity issue: 146355 Fixes: 792e749e92d5 ("net/mlx5: fix register usage in meter") Cc: stable@dpdk.org Signed-off-by: Michael Baum <michaelba@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
DPDK is a set of libraries and drivers for fast packet processing. It supports many processor architectures and both FreeBSD and Linux. The DPDK uses the Open Source BSD-3-Clause license for the core libraries and drivers. The kernel components are GPL-2.0 licensed. Please check the doc directory for release notes, API documentation, and sample application information. For questions and usage discussions, subscribe to: users@dpdk.org Report bugs and issues to the development mailing list: dev@dpdk.org
Description
Languages
C
99.1%
Meson
0.5%
Python
0.2%
Shell
0.1%