On 6/9/2015 1:55 AM, Hefty, Sean wrote:
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1174,6 +1174,18 @@ static int clean_mr(struct mlx5_ib_mr *mr)
        int umred = mr->umred;
        int err;

+       if (mr->sig) {
+               if (mlx5_core_destroy_psv(dev->mdev,
+                                         mr->sig->psv_memory.psv_idx))
+                       mlx5_ib_warn(dev, "failed to destroy mem psv %d\n",
+                                    mr->sig->psv_memory.psv_idx);
+               if (mlx5_core_destroy_psv(dev->mdev,
+                                         mr->sig->psv_wire.psv_idx))
+                       mlx5_ib_warn(dev, "failed to destroy wire psv %d\n",
+                                    mr->sig->psv_wire.psv_idx);
+               kfree(mr->sig);
+       }
+
        if (!umred) {
                err = destroy_mkey(dev, mr);
                if (err) {

This patch doesn't introduce this problem, but the err check suggests that 
deregistration can fail for some reason.
If so, should mr->sig be cleared above, so that a second call to dereg doesn't 
attempt to free the memory twice?


Hi Sean,

clean_mr() failure is not propagated back at the moment, but you are
correct, it's not a good idea to rely on that. I'll clear mr->sig in
v2.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to