[PATCH 21.11 1/2] net/mlx5: fix race condition in counter pool resizing

Kevin Traynor ktraynor at redhat.com
Tue Nov 29 12:50:41 CET 2022


On 24/11/2022 07:53, Michael Baum wrote:
> [ upstream commit a94e89e47b59ebaf84246bbb34c06e1a004cde8a ]
> 
> Counter management structure has array of counter pools. This array is
> invalid in management structure initialization and grows on demand.
> 
> The resizing include:
> 1. Allocate memory for the new size.
> 2. Copy the existing data to the new memory.
> 3. Move the pointer to the new memory.
> 4. Free the old memory.
> 
> The third step can be performed before for this function, and compiler
> may do that, but another thread might read the pointer before coping and
> read invalid data or even crash.
> 
> This patch allocates memory for this array once in management structure
> initialization and limit the counters number by 16M.
> 
> Fixes: 3aa279157fa0 ("net/mlx5: synchronize flow counter pool creation")
> 
> Signed-off-by: Michael Baum<michaelba at nvidia.com>
> Acked-by: Matan Azrad<matan at nvidia.com>
> ---

Thanks for the backports. Applied both patches to 21.11 branch.



More information about the stable mailing list