Skip to content

Commit

Permalink
IB/mlx4: Fix an error handling path in 'mlx4_ib_rereg_user_mr()'
Browse files Browse the repository at this point in the history
Before returning -EPERM we should release some resources, as already done
in the other error handling path of the function.

Fixes: d8f9cc3 ("IB/mlx4: Mark user MR as writable if actual virtual memory is writable")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Christophe Jaillet authored and Jason Gunthorpe committed Jun 11, 2018
1 parent 425cf5c commit 3dc7c7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/infiniband/hw/mlx4/mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,11 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags,
}

if (flags & IB_MR_REREG_ACCESS) {
if (ib_access_writable(mr_access_flags) && !mmr->umem->writable)
return -EPERM;
if (ib_access_writable(mr_access_flags) &&
!mmr->umem->writable) {
err = -EPERM;
goto release_mpt_entry;
}

err = mlx4_mr_hw_change_access(dev->dev, *pmpt_entry,
convert_access(mr_access_flags));
Expand Down

0 comments on commit 3dc7c7b

Please sign in to comment.