IB/mlx5: Fix memory leak in clean_mr error path
In clean_mr error path the 'mr' should be freed.
Fixes: e126ba97db
('mlx5: Add driver for Mellanox Connect-IB adapters')
Signed-off-by: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
ff740aefec
commit
5942d8ae41
|
@ -1490,19 +1490,19 @@ static int clean_mr(struct mlx5_ib_mr *mr)
|
||||||
mlx5_free_priv_descs(mr);
|
mlx5_free_priv_descs(mr);
|
||||||
|
|
||||||
if (!allocated_from_cache) {
|
if (!allocated_from_cache) {
|
||||||
|
u32 key = mr->mmkey.key;
|
||||||
|
|
||||||
err = destroy_mkey(dev, mr);
|
err = destroy_mkey(dev, mr);
|
||||||
|
kfree(mr);
|
||||||
if (err) {
|
if (err) {
|
||||||
mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n",
|
mlx5_ib_warn(dev, "failed to destroy mkey 0x%x (%d)\n",
|
||||||
mr->mmkey.key, err);
|
key, err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mlx5_mr_cache_free(dev, mr);
|
mlx5_mr_cache_free(dev, mr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allocated_from_cache)
|
|
||||||
kfree(mr);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue