lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] staging: r8188eu: fix a potential memory leak in _rtw_init_cmd_priv()
On Thu, Mar 31, 2022 at 12:15:35AM +0800, xkernel.wang@foxmail.com wrote:
> From: Xiaoke Wang <xkernel.wang@foxmail.com>
>
> In _rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated
> in failure, `pcmdpriv->cmd_allocated_buf` is not properly released.
> This patch is to free it.
>
> Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
> ---
> ChangeLog:
> v1->v2: simplify the function.
> drivers/staging/r8188eu/core/rtw_cmd.c | 21 +++++----------------
> 1 file changed, 5 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
> index 56910c3..3de3a39 100644
> --- a/drivers/staging/r8188eu/core/rtw_cmd.c
> +++ b/drivers/staging/r8188eu/core/rtw_cmd.c
> @@ -17,8 +17,6 @@ No irqsave is necessary.
>
> static int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
> {
> - int res = _SUCCESS;
> -
> sema_init(&pcmdpriv->cmd_queue_sema, 0);
> /* sema_init(&(pcmdpriv->cmd_done_sema), 0); */
> sema_init(&pcmdpriv->terminate_cmdthread_sema, 0);
> @@ -26,34 +24,25 @@ static int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
> _rtw_init_queue(&pcmdpriv->cmd_queue);
>
> /* allocate DMA-able/Non-Page memory for cmd_buf and rsp_buf */
> -
> pcmdpriv->cmd_seq = 1;
> -

Why make whitespace cleanups at the same time? Please do not do that.

And I do not think this patch applies anymore _rtw_init_queue() is not
in my tree. Please rebase and fix up and resend.

thanks,

greg k-h

\
 
 \ /
  Last update: 2022-03-31 08:07    [W:0.032 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site