IB/mlx5: Take write semaphore when changing the vma struct
authorMaor Gottlieb <maorg@mellanox.com>
Wed, 29 Mar 2017 03:03:02 +0000 (06:03 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Mar 2018 10:00:13 +0000 (11:00 +0100)
commit9238066e2838e2981c908e66bfc599442fd6917b
tree32a6813a87f9622af364eaa0d5708e979a1b700e
parentdf7aedb171e262c4f2c692f323bc9b1c8c13ef59
IB/mlx5: Take write semaphore when changing the vma struct

[ Upstream commit ecc7d83be3243835c9396a1a2fb8ce95f205207b ]

When the driver disassociate user context, it changes the vma to
anonymous by setting the vm_ops to null and zap the vma ptes.

In order to avoid race in the kernel, we need to take write lock
before we change the vma entries.

Fixes: 7c2344c3bbf97 ('IB/mlx5: Implements disassociate_ucontext API')
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/mlx5/main.c