|
|
d8f823 |
From b11609d6b8e59125faa68ca14e005ab09b8cebde Mon Sep 17 00:00:00 2001
|
|
|
d8f823 |
From: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Date: Tue, 12 May 2020 10:54:14 -0400
|
|
|
d8f823 |
Subject: [PATCH 151/312] [netdrv] net/mlx5: IPsec, fix memory leak at
|
|
|
d8f823 |
mlx5_fpga_ipsec_delete_sa_ctx
|
|
|
d8f823 |
|
|
|
d8f823 |
Message-id: <20200512105530.4207-49-ahleihel@redhat.com>
|
|
|
d8f823 |
Patchwork-id: 306920
|
|
|
d8f823 |
Patchwork-instance: patchwork
|
|
|
d8f823 |
O-Subject: [RHEL8.3 BZ 1789382 048/124] net/mlx5: IPsec, fix memory leak at mlx5_fpga_ipsec_delete_sa_ctx
|
|
|
d8f823 |
Bugzilla: 1789382
|
|
|
d8f823 |
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Kamal Heib <kheib@redhat.com>
|
|
|
d8f823 |
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Bugzilla: http://bugzilla.redhat.com/1789382
|
|
|
d8f823 |
Upstream: v5.6-rc1
|
|
|
d8f823 |
|
|
|
d8f823 |
commit 08db2cf577487f5123aebcc2f913e0b8a2c14b43
|
|
|
d8f823 |
Author: Raed Salem <raeds@mellanox.com>
|
|
|
d8f823 |
Date: Wed Oct 23 16:41:21 2019 +0300
|
|
|
d8f823 |
|
|
|
d8f823 |
net/mlx5: IPsec, fix memory leak at mlx5_fpga_ipsec_delete_sa_ctx
|
|
|
d8f823 |
|
|
|
d8f823 |
SA context is allocated at mlx5_fpga_ipsec_create_sa_ctx,
|
|
|
d8f823 |
however the counterpart mlx5_fpga_ipsec_delete_sa_ctx function
|
|
|
d8f823 |
nullifies sa_ctx pointer without freeing the memory allocated,
|
|
|
d8f823 |
hence the memory leak.
|
|
|
d8f823 |
|
|
|
d8f823 |
Fix by free SA context when the SA is released.
|
|
|
d8f823 |
|
|
|
d8f823 |
Fixes: d6c4f0298cec ("net/mlx5: Refactor accel IPSec code")
|
|
|
d8f823 |
Signed-off-by: Raed Salem <raeds@mellanox.com>
|
|
|
d8f823 |
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
|
|
|
d8f823 |
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
|
|
|
d8f823 |
|
|
|
d8f823 |
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
|
|
|
d8f823 |
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
|
|
|
d8f823 |
---
|
|
|
d8f823 |
drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c | 1 +
|
|
|
d8f823 |
1 file changed, 1 insertion(+)
|
|
|
d8f823 |
|
|
|
d8f823 |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
|
|
|
d8f823 |
index 4ed4d4d8e073..4c61d25d2e88 100644
|
|
|
d8f823 |
--- a/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
|
|
|
d8f823 |
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c
|
|
|
d8f823 |
@@ -850,6 +850,7 @@ void mlx5_fpga_ipsec_delete_sa_ctx(void *context)
|
|
|
d8f823 |
mutex_lock(&fpga_xfrm->lock);
|
|
|
d8f823 |
if (!--fpga_xfrm->num_rules) {
|
|
|
d8f823 |
mlx5_fpga_ipsec_release_sa_ctx(fpga_xfrm->sa_ctx);
|
|
|
d8f823 |
+ kfree(fpga_xfrm->sa_ctx);
|
|
|
d8f823 |
fpga_xfrm->sa_ctx = NULL;
|
|
|
d8f823 |
}
|
|
|
d8f823 |
mutex_unlock(&fpga_xfrm->lock);
|
|
|
d8f823 |
--
|
|
|
d8f823 |
2.13.6
|
|
|
d8f823 |
|