summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorKamal Heib2017-08-17 14:52:31 +0200
committerDoug Ledford2017-08-24 23:47:34 +0200
commit5942d8ae411775b76e5e1ab0cce57b0666516f2d (patch)
tree7f5ecfa1bb29c5fe4f539c9533e132a18c89e16d /drivers/infiniband/hw
parentIB/mlx5: Decouple MR allocation and population flows (diff)
downloadkernel-qcow2-linux-5942d8ae411775b76e5e1ab0cce57b0666516f2d.tar.gz
kernel-qcow2-linux-5942d8ae411775b76e5e1ab0cce57b0666516f2d.tar.xz
kernel-qcow2-linux-5942d8ae411775b76e5e1ab0cce57b0666516f2d.zip
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')
-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;
}