All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Xiaoke Wang" <xkernel.wang@foxmail.com>
To: gregkh <gregkh@linuxfoundation.org>
Cc: larry.finger <larry.finger@lwfinger.net>,
	 phil <phil@philpotter.co.uk>,
	 linux-staging <linux-staging@lists.linux.dev>,
	 linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH] staging: r8188eu: check the return value of kzalloc()
Date: Wed, 30 Mar 2022 15:34:24 +0800	[thread overview]
Message-ID: <tencent_4E078E318ADFF03325CAFF5D9043E6A15C07@qq.com> (raw)
In-Reply-To: YkMsTz/iJdgmUxtS@kroah.com

On Tue, 29 Mar 2022 23:57:10 +0800, gregkh@linuxfoundation.org wrote:
>> --- a/drivers/staging/r8188eu/core/rtw_xmit.c
>> +++ b/drivers/staging/r8188eu/core/rtw_xmit.c
>> @@ -180,6 +180,10 @@ s32	_rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
>>  	pxmitpriv->free_xmit_extbuf_cnt = num_xmit_extbuf;
>>  
>>  	rtw_alloc_hwxmits(padapter);
>> +	if (!pxmitpriv->hwxmits) {
>> +		res = _FAIL;
>> +		goto exit;
>> +	}
>
> You just leaked memory resources :(
>

Sorry, you are right. I tracked the callers of _rtw_init_xmit_priv() and
found that they do not properly release the resources allocated by this
funciton. This means that the other error paths can also bring memory
leaks, as well as the same function in
drivers/staging/rtl8723bs/core/rtw_xmit.c.
There are also several similar issuses of alloc_hwxmits() and 
_r8712_init_xmit_priv() in drivers/staging/rtl8712/rtl871x_xmit.c.
I will try to carefully fix them.

Regards,
Xiaoke Wang


      parent reply	other threads:[~2022-03-30  7:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-25  6:53 [PATCH] staging: r8188eu: check the return value of kzalloc() xkernel.wang
2022-03-29 15:57 ` Greg KH
2022-03-29 16:53   ` Xiaoke Wang
2022-03-30  7:34   ` Xiaoke Wang [this message]

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=tencent_4E078E318ADFF03325CAFF5D9043E6A15C07@qq.com \
    --to=xkernel.wang@foxmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=larry.finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=phil@philpotter.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.