summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/mlx5
diff options
context:
space:
mode:
authorKamal Heib <kamalh@mellanox.com>2017-08-17 15:52:31 +0300
committerDoug Ledford <dledford@redhat.com>2017-08-25 00:47:34 +0300
commit5942d8ae411775b76e5e1ab0cce57b0666516f2d (patch)
tree7f5ecfa1bb29c5fe4f539c9533e132a18c89e16d /drivers/infiniband/hw/mlx5
parentff740aefecb98da4605df1cada7904c44eaee161 (diff)
downloadlinux-5942d8ae411775b76e5e1ab0cce57b0666516f2d.tar.xz
IB/mlx5: Fix memory leak in clean_mr error path
In clean_mr error path the 'mr' should be freed. Fixes: e126ba97dba9 ('mlx5: Add driver for Mellanox Connect-IB adapters') Signed-off-by: Kamal Heib <kamalh@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx5')
-rw-r--r--drivers/infiniband/hw/mlx5/mr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index aa6f71570b77..8cf53eb13148 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1490,19 +1490,19 @@ static int clean_mr(struct mlx5_ib_mr *mr)
mlx5_free_priv_descs(mr);
if (!allocated_from_cache) {
+ u32 key = mr->mmkey.key;
+
err = destroy_mkey(dev, mr);
+ kfree(mr);
if (err) {
mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n",
- mr->mmkey.key, err);
+ key, err);
return err;
}
} else {
mlx5_mr_cache_free(dev, mr);
}
- if (!allocated_from_cache)
- kfree(mr);
-
return 0;
}