lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 07 Mar 2014 15:01:34 -0500
From:	"Wang, Xiaoming" <>
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 forgotten branch to avoid memory leak.

Signed-off-by: Zhang Dongxing <>
Signed-off-by: xiaoming wang <>

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 82fe8c4..cec9db9 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -314,6 +314,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;


@@ -350,6 +351,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;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists