From: Greg KH <gregkh@linuxfoundation.org>
To: "Wang, Xiaoming" <xiaoming.wang@intel.com>
Cc: valentina.manea.m@gmail.com, dan.carpenter@oracle.com,
standby24x7@gmail.com, devel@driverdev.osuosl.org,
chuansheng.liu@intel.com, dongxing.zhang@intel.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [staging][r8188eu]: memory leak in rtw_free_cmd_obj if command is (_Set_Drv_Extra)
Date: Mon, 17 Mar 2014 14:38:52 -0700 [thread overview]
Message-ID: <20140317213852.GA29071@kroah.com> (raw)
In-Reply-To: <1394465864.27962.2.camel@wxm-ubuntu>
On Mon, Mar 10, 2014 at 11:37:44AM -0400, Wang, Xiaoming wrote:
> pcmd->parmbuf->pbuf has been allocated if command is GEN_CMD_CODE(_Set_Drv_Extra),
> and it enqueued by rtw_enqueue_cmd. rtw_cmd_thread dequeue pcmd by rtw_dequeue_cmd.
> The memory leak happened on this branch "if( _FAIL == rtw_cmd_filter(pcmdpriv, pcmd) )"
> which goto post_process directly against freeing pcmd->parmbuf->pbuf in
> rtw_drvextra_cmd_hdl which is the cmd_hdl if command is (_Set_Drv_Extra).
> This patch free pcmd->parmbuf->pbuf on the forgotten branch to avoid memory leak.
>
> Signed-off-by: Zhang Dongxing <dongxing.zhang@intel.com>
> Signed-off-by: xiaoming wang <xiaoming.wang@intel.com>
> Reviewed-by: Chuansheng Liu <chuansheng.liu@intel.com>
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> index c0a0a52..1c7f505 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
> @@ -288,7 +288,7 @@ int rtw_cmd_thread(void *context)
> void (*pcmd_callback)(struct adapter *dev, struct cmd_obj *pcmd);
> struct adapter *padapter = (struct adapter *)context;
> struct cmd_priv *pcmdpriv = &(padapter->cmdpriv);
> -
> + struct drvextra_cmd_parm *extra_parm = NULL;
>
> thread_enter("RTW_CMD_THREAD");
>
> @@ -323,6 +323,11 @@ _next:
>
> if (_FAIL == rtw_cmd_filter(pcmdpriv, pcmd)) {
> pcmd->res = H2C_DROPPED;
> + if (pcmd->cmdcode == GEN_CMD_CODE(_Set_Drv_Extra)) {
> + extra_parm = (struct drvextra_cmd_parm *)pcmd->parmbuf;
> + if (extra_parm && extra_parm->pbuf && extra_parm->size > 0)
> + rtw_mfree(extra_parm->pbuf, extra_parm->size);
> + }
> goto post_process;
> }
>
This patch has all the tabs converted to spaces and can not be applied
:(
Please fix your email client and try again.
greg k-h
next prev parent reply other threads:[~2014-03-17 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 15:37 [PATCH] [staging][r8188eu]: memory leak in rtw_free_cmd_obj if command is (_Set_Drv_Extra) Wang, Xiaoming
2014-03-10 1:44 ` Liu, Chuansheng
2014-03-17 21:38 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-03-18 14:25 Wang, Xiaoming
2014-03-18 20:03 ` [PATCH] staging: r8188eu: " Greg KH
2014-03-26 8:53 ` [PATCH] [staging][r8188eu]: " Dan Carpenter
2014-03-07 20:01 Wang, Xiaoming
2014-03-07 8:04 ` Dan Carpenter
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=20140317213852.GA29071@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=chuansheng.liu@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=dongxing.zhang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=standby24x7@gmail.com \
--cc=valentina.manea.m@gmail.com \
--cc=xiaoming.wang@intel.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