lkml.org 
[lkml]   [2021]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH -next] staging: rtl8192e: rtllib_module: fix missing free_netdev() on error in alloc_rtllib()
From
Date
Hi,

On 2021/12/1 2:57, Pavel Skripkin wrote:
> On 11/30/21 06:40, Yang Yingliang wrote:
>> Add the missing free_netdev() before return from alloc_rtllib()
>> in the error handling case.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/staging/rtl8192e/rtllib_module.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/rtl8192e/rtllib_module.c
>> b/drivers/staging/rtl8192e/rtllib_module.c
>> index 64d9feee1f39..18d898714c5c 100644
>> --- a/drivers/staging/rtl8192e/rtllib_module.c
>> +++ b/drivers/staging/rtl8192e/rtllib_module.c
>> @@ -125,7 +125,7 @@ struct net_device *alloc_rtllib(int sizeof_priv)
>>         ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput),
>> GFP_KERNEL);
>>       if (!ieee->pHTInfo)
>> -        return NULL;
>> +        goto failed;
>>         HTUpdateDefaultSetting(ieee);
>>       HTInitializeHTInfo(ieee);
>>
>
> Good catch!
>
> There are 2 more possible leaks, tho. rtllib_networks_allocate() and
> rtllib_softmac_init() should be unwinded too.
The error path of rtllib_networks_allocate()  won't leak the dev.
>
> For some odd reason rtllib_softmac_init() does not return an error in
> case of allocation failure, but it should be fixed. I think, it worth
> to fix whole error handling in one patch
I will send a v2 to fix this.

Thanks,
Yang
>
>
>
>
> With regards,
> Pavel Skripkin
> .

\
 
 \ /
  Last update: 2021-12-01 03:42    [W:0.487 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site