public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: Yang Yingliang <yangyingliang@huawei.com>,
	linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Cc: gregkh@linuxfoundation.org
Subject: Re: [PATCH -next] staging: rtl8192e: rtllib_module: fix missing free_netdev() on error in alloc_rtllib()
Date: Tue, 30 Nov 2021 21:57:23 +0300	[thread overview]
Message-ID: <851b57b9-79ac-e7a1-a61a-6f36a5d9d77a@gmail.com> (raw)
In-Reply-To: <20211130034007.779351-1-yangyingliang@huawei.com>

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.

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




With regards,
Pavel Skripkin

  reply	other threads:[~2021-11-30 18:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30  3:40 [PATCH -next] staging: rtl8192e: rtllib_module: fix missing free_netdev() on error in alloc_rtllib() Yang Yingliang
2021-11-30 18:57 ` Pavel Skripkin [this message]
2021-12-01  2:41   ` Yang Yingliang
2021-12-01  6:55     ` Dan Carpenter
2021-12-01  7:29       ` Yang Yingliang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=851b57b9-79ac-e7a1-a61a-6f36a5d9d77a@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox