git: e4d178d09328 - main - mlx5ib: Fix memory leak in clean_mr() error path
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Jun 2022 15:06:35 UTC
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=e4d178d093281419c5ad9dea1c497bceb54d0018 commit e4d178d093281419c5ad9dea1c497bceb54d0018 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-13 15:00:16 +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 MFC after: 1 week Sponsored by: NVIDIA Networking --- 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 d89050c57e10..5fe7e4e7742a 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; }