diff options
author | Christophe Jaillet <christophe.jaillet@wanadoo.fr> | 2018-06-11 14:15:11 -0400 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-06-11 14:43:41 -0400 |
commit | 3dc7c7badb7502ec3e3aa817a8bdd9e53aa54c52 (patch) | |
tree | a0f0646be188fa64044828964c64db81bc868217 | |
parent | 425cf5c1350a98b81f3ddda160b99c3be613a213 (diff) |
IB/mlx4: Fix an error handling path in 'mlx4_ib_rereg_user_mr()'
Before returning -EPERM we should release some resources, as already done
in the other error handling path of the function.
Fixes: d8f9cc328c88 ("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>
-rw-r--r-- | drivers/infiniband/hw/mlx4/mr.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index ed1f253faf97..c7c85c22e4e3 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c | |||
@@ -486,8 +486,11 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
486 | } | 486 | } |
487 | 487 | ||
488 | if (flags & IB_MR_REREG_ACCESS) { | 488 | if (flags & IB_MR_REREG_ACCESS) { |
489 | if (ib_access_writable(mr_access_flags) && !mmr->umem->writable) | 489 | if (ib_access_writable(mr_access_flags) && |
490 | return -EPERM; | 490 | !mmr->umem->writable) { |
491 | err = -EPERM; | ||
492 | goto release_mpt_entry; | ||
493 | } | ||
491 | 494 | ||
492 | err = mlx4_mr_hw_change_access(dev->dev, *pmpt_entry, | 495 | err = mlx4_mr_hw_change_access(dev->dev, *pmpt_entry, |
493 | convert_access(mr_access_flags)); | 496 | convert_access(mr_access_flags)); |