git: 492f5e649493 - stable/13 - mlx5ib: Fix memory leak in clean_mr() error path
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 20 Jun 2022 11:12:49 UTC
The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=492f5e649493fa7ae3a4ff4df886ba4312ffa8db commit 492f5e649493fa7ae3a4ff4df886ba4312ffa8db Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2022-06-13 14:46:47 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2022-06-20 11:08:39 +0000 mlx5ib: Fix memory leak in clean_mr() error path In the clean_mr() error path the 'mr' should be freed. Linux commit: 5942d8ae411775b76e5e1ab0cce57b0666516f2d PR: 264653 Sponsored by: NVIDIA Networking (cherry picked from commit e4d178d093281419c5ad9dea1c497bceb54d0018) --- sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c index 6e4122f57f4b..5e6bd7a8dcca 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c @@ -1285,10 +1285,13 @@ static int clean_mr(struct mlx5_ib_mr *mr) mlx5_free_priv_descs(mr); if (!umred) { + 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 { @@ -1300,9 +1303,6 @@ static int clean_mr(struct mlx5_ib_mr *mr) free_cached_mr(dev, mr); } - if (!umred) - kfree(mr); - return 0; }