mirror of
https://github.com/torvalds/linux.git
synced 2024-12-30 23:02:08 +00:00
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user