]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/mlx5: Fix assigning access flags to cache mkeys
authorMichael Guralnik <michaelgur@nvidia.com>
Wed, 20 Sep 2023 10:01:54 +0000 (13:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 20:03:05 +0000 (22:03 +0200)
commit6dd42618ffddd2116aec9778862040e370515961
tree7a3d43fc13ab48bf97afa8d1316d2284d5a100ad
parent42ec848172ef9bf19e2e0bbe0d941132481c13e8
RDMA/mlx5: Fix assigning access flags to cache mkeys

commit 4f14c6c0213e1def48f0f887d35f44095416c67d upstream.

After the change to use dynamic cache structure, new cache entries
can be added and the mkey allocation can no longer assume that all
mkeys created for the cache have access_flags equal to zero.

Example of a flow that exposes the issue:
A user registers MR with RO on a HCA that cannot UMR RO and the mkey is
created outside of the cache. When the user deregisters the MR, a new
cache entry is created to store mkeys with RO.

Later, the user registers 2 MRs with RO. The first MR is reused from the
new cache entry. When we try to get the second mkey from the cache we see
the entry is empty so we go to the MR cache mkey allocation flow which
would have allocated a mkey with no access flags, resulting the user getting
a MR without RO.

Fixes: dd1b913fb0d0 ("RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow")
Reviewed-by: Edward Srouji <edwards@nvidia.com>
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Link: https://lore.kernel.org/r/8a802700b82def3ace3f77cd7a9ad9d734af87e7.1695203958.git.leonro@nvidia.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/mlx5/mr.c