lkml.org 
[lkml]   [2021]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] function mana_hwc_create_wq leaks memory
Date
> From: Dhiraj Shah <find.dhiraj@gmail.com>
> Sent: Thursday, June 10, 2021 8:29 AM
> ...
> memory space allocated for the queue in function
> mana_gd_create_hwc_queue is not freed during error condition.
>
> Signed-off-by: Dhiraj Shah <find.dhiraj@gmail.com>
> ---
> drivers/net/ethernet/microsoft/mana/hw_channel.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/hw_channel.c
> b/drivers/net/ethernet/microsoft/mana/hw_channel.c
> index 1a923fd99990..4aa4bda518fb 100644
> --- a/drivers/net/ethernet/microsoft/mana/hw_channel.c
> +++ b/drivers/net/ethernet/microsoft/mana/hw_channel.c
> @@ -501,8 +501,10 @@ static int mana_hwc_create_wq(struct
> hw_channel_context *hwc,
> *hwc_wq_ptr = hwc_wq;
> return 0;
> out:
> - if (err)
> + if (err) {

Here the 'err' must be non-zero. Can you please remove this 'if'?

> + kfree(queue);
> mana_hwc_destroy_wq(hwc, hwc_wq);
> + }
> return err;
> }

Reviewed-by: Dexuan Cui <decui@microsoft.com>

\
 
 \ /
  Last update: 2021-06-10 19:18    [W:1.919 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site