mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
IB/mlx5: Properly support implicit ODP rereg_mr
Due to all the child mkeys in the implicit ODP configuration we cannot
change anything in place for the parent mkey. Instead the whole thing
needs to be rebuilt if any change is requested. If the user does not
specify a translation then force the implicit values which will then fall
through the logic into mlx5_ib_reg_user_mr() to allocate a completely new
MR.
Since implicit children were also touching the mr->pd, this removes
another case where the access was racy.
Fixes: ef3642c4f5 ("RDMA/mlx5: Fix error unwinds for rereg_mr")
Link: https://sashiko.dev/#/patchset/20260427-security-bug-fixes-v3-0-4621fa52de0e%40nvidia.com?part=4
Link: https://patch.msgid.link/r/3-v1-29ebd2c229b5+fd5-ib_mr_pd_jgg@nvidia.com
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
parent
93e64c7a33
commit
ee7a833506
|
|
@ -1188,6 +1188,21 @@ struct ib_mr *mlx5_ib_rereg_user_mr(struct ib_mr *ib_mr, int flags, u64 start,
|
|||
if (!(flags & IB_MR_REREG_PD))
|
||||
new_pd = ib_mr->pd;
|
||||
|
||||
if (mr->is_odp_implicit && !(flags & IB_MR_REREG_TRANS)) {
|
||||
if (!(new_access_flags & IB_ACCESS_ON_DEMAND))
|
||||
return ERR_PTR(-EOPNOTSUPP);
|
||||
|
||||
/*
|
||||
* Due to all the child mkeys we cannot actually change an
|
||||
* implicit MR in place. If the user did not specify a new
|
||||
* translation then force the fixed implicit MR values.
|
||||
*/
|
||||
start = 0;
|
||||
iova = 0;
|
||||
length = U64_MAX;
|
||||
flags |= IB_MR_REREG_TRANS;
|
||||
}
|
||||
|
||||
if (!(flags & IB_MR_REREG_TRANS)) {
|
||||
struct ib_umem *umem;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user