[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27240C0AC20F114CBF8149A2696CBE4A01C4D7AE@SHSMSX101.ccr.corp.intel.com>
Date: Mon, 10 Mar 2014 01:44:59 +0000
From: "Liu, Chuansheng" <chuansheng.liu@...el.com>
To: "Wang, Xiaoming" <xiaoming.wang@...el.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"valentina.manea.m@...il.com" <valentina.manea.m@...il.com>,
"dan.carpenter@...cle.com" <dan.carpenter@...cle.com>,
"standby24x7@...il.com" <standby24x7@...il.com>
CC: "devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Zhang, Dongxing" <dongxing.zhang@...el.com>
Subject: RE: [PATCH] [staging][r8188eu]: memory leak in rtw_free_cmd_obj if
command is (_Set_Drv_Extra)
Hi,
> -----Original Message-----
> From: Wang, Xiaoming
> Sent: Monday, March 10, 2014 11:38 PM
> To: gregkh@...uxfoundation.org; valentina.manea.m@...il.com;
> dan.carpenter@...cle.com; standby24x7@...il.com
> Cc: devel@...verdev.osuosl.org; linux-kernel@...r.kernel.org; Zhang,
> Dongxing; Wang, Xiaoming; Liu, Chuansheng
> Subject: [PATCH] [staging][r8188eu]: memory leak in rtw_free_cmd_obj if
> command is (_Set_Drv_Extra)
>
> 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@...el.com>
> Signed-off-by: xiaoming wang <xiaoming.wang@...el.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;
> }
>
Reviewed-by: Chuansheng Liu <chuansheng.liu@...el.com>
Thanks.
Best Regards
Chuansheng
Powered by blists - more mailing lists