git: d264494e983a - stable/13 - mlx4core: Fix a memory leak when deleting slave's resources

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Tue, 07 Jun 2022 06:45:07 UTC
The branch stable/13 has been updated by hselasky:

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

commit d264494e983ac964dc5cb8a2e51cddbb9d6c3631
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2022-05-30 18:11:50 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2022-06-07 06:44:29 +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
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit f29c9901a41fb650d46fd48f4880a894f54aa737)
---
 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;