diff options
author | Kamal Heib <kamalh@mellanox.com> | 2017-08-17 15:52:31 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-08-25 00:47:34 +0300 |
commit | 5942d8ae411775b76e5e1ab0cce57b0666516f2d (patch) | |
tree | 7f5ecfa1bb29c5fe4f539c9533e132a18c89e16d /drivers/infiniband/hw/mlx5 | |
parent | ff740aefecb98da4605df1cada7904c44eaee161 (diff) | |
download | linux-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.c | 8 |
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; } |