RE: [PATCH] function mana_hwc_create_wq leaks memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Dexuan Cui <decui@xxxxxxxxxxxxx>
> Sent: Thursday, June 10, 2021 10:18 AM
> ...
> > 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@xxxxxxxxxxxxx>

Hi Dhiraj,
I checked the code again and it looks like your patch is actually
unnecessary as IMO there is no memory leak here: the 'queue'
pointer is passed to mana_hwc_destroy_wq() as hwc_wq->gdma_wq,
and is later freed in mana_gd_destroy_queue() ->
mana_gd_destroy_queue().

The 'if' test can be removed as the 'err's is always non-zero there.

Thanks,
Dexuan




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux