]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Fix race for multiple RoCE enable
authorDaniel Jurgens <danielj@mellanox.com>
Thu, 4 Jan 2018 15:25:31 +0000 (17:25 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 8 Jan 2018 18:42:20 +0000 (11:42 -0700)
commitfe7e5e1a06ba1eeb8d8e10a9a46f59c898f722e8
tree4c6bd43972f743d469b5c9d1f875cc9bd6ca2a26
parentdb517196ede33602d7527474edb5df5e48db7458
net/mlx5: Fix race for multiple RoCE enable

There are two potential problems with the existing implementation.

1. Enable and disable can race after the atomic operations.
2. If a command fails the refcount is left in an inconsistent state.

Introduce a lock and perform error checking.

Fixes: a1b207f0568e ("net/mlx5: Add support for multiple RoCE enable")
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/vport.c
include/linux/mlx5/driver.h