git: f29c9901a41f - main - mlx4core: Fix a memory leak when deleting slave's resources

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Mon, 30 May 2022 18:22:56 UTC
The branch main has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=f29c9901a41fb650d46fd48f4880a894f54aa737

commit f29c9901a41fb650d46fd48f4880a894f54aa737
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-05-30 18:11:50 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-05-30 18:22:18 +0000

    mlx4core: Fix a memory leak when deleting slave's resources
    
    mlx4_delete_all_resources_for_slave() in the resource tracker should free
    all memory allocated for a slave. While releasing memory of fs_rule,
    it misses releasing memory of fs_rule->mirr_mbox.
    
    Linux commit:
    461d5f1b59490ce0096dfda45e10038c122a7892
    
    PR:             264249
    MFC after:      1 week
    Sponsored by:   NVIDIA Networking
---
 sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c b/sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c
index 4e4b04758e11..95ab8a8142a5 100644
--- a/sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c
+++ b/sys/dev/mlx4/mlx4_core/mlx4_resource_tracker.c
@@ -5063,6 +5063,7 @@ static void rem_slave_fs_rule(struct mlx4_dev *dev, int slave)
 						 &tracker->res_tree[RES_FS_RULE]);
 					list_del(&fs_rule->com.list);
 					spin_unlock_irq(mlx4_tlock(dev));
+					kfree(fs_rule->mirr_mbox);
 					kfree(fs_rule);
 					state = 0;
 					break;