[PATCH] common/mlx5: fix memory leak in Windows dereg MR function

Raslan Darawsheh rasland at nvidia.com
Wed Nov 17 15:44:29 CET 2021


Hi,

> -----Original Message-----
> From: Michael Baum <michaelba at nvidia.com>
> Sent: Wednesday, November 17, 2021 1:03 PM
> To: dev at dpdk.org
> Cc: Matan Azrad <matan at nvidia.com>; Raslan Darawsheh
> <rasland at nvidia.com>; Slava Ovsiienko <viacheslavo at nvidia.com>; Michael
> Baum <michaelba at nvidia.com>; stable at dpdk.org
> Subject: [PATCH] common/mlx5: fix memory leak in Windows dereg MR
> function
> 
> From: Michael Baum <michaelba at nvidia.com>
> 
> The "mlx5_devx_cmd_mkey_create" DevX cmd allocates DevX object using
> mlx5_malloc and then creates MKey using glue function.
> Compatibly, "mlx5_devx_cmd_destroy" cmd releases first the MKey using
> glue function, and then free the DevX object using mlx5_free.
> 
> On Windows OS, the reg_mr function creates Mkey using
> "mlx5_devx_cmd_mkey_create" cmd, but dereg_mr function using directly
> glue function without freeing the object.
> This behavior causes memory leak at each MR release.
> 
> In addition, the dereg_mr function makes sure that the MR pointer is
> valid before destroying its fields, but always calls the memset function
> that makes a difference to it.
> 
> This patch moves the dereg_mr function to use "mlx5_devx_cmd_destroy"
> instead of glue function, and extends the validity test to the whole
> function.
> 
> Fixes: ba420719823c ("common/mlx5: add reg/dereg MR on Windows")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Michael Baum <michaelba at nvidia.com>
> Acked-by: Matan Azrad <matan at nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh


More information about the stable mailing list