common/mlx5: fix device list operations concurrency
authorMichael Baum <michaelba@nvidia.com>
Sun, 12 Sep 2021 10:36:27 +0000 (13:36 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 20 Sep 2021 21:16:29 +0000 (23:16 +0200)
commitdc26c9c21b8a6a9768219b558e08f6a780014ff0
treef5c13acdbe67972e377496c682261849914bb744
parent288d7c3fa6e8bfca9e1e79a9712ec85d7179b3ce
common/mlx5: fix device list operations concurrency

The mlx5 common driver has a global list of mlx5 devices which are
probed.

In probe function it creates one and insert it to the list. Similarly it
removes the device in remove function.
These operations are not safe as there can be such operations in
parallel, by different threads.

Add global lock for the list and use it to insert or remove.

Fixes: 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/common/mlx5/mlx5_common.c