aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/r8188eu/core/rtw_xmit.c
diff options
context:
space:
mode:
authorXiaoke Wang <xkernel.wang@foxmail.com>2022-09-12 10:50:26 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-09-24 13:08:41 +0200
commitf63ed6cf93014c7fac56d82069801a26ab8b04a6 (patch)
treeb1fba640b9b9f2eddd88c054d05b37815afd888d /drivers/staging/r8188eu/core/rtw_xmit.c
parentstaging: r8188eu: remove recv_osdep.h (diff)
downloadlinux-dev-f63ed6cf93014c7fac56d82069801a26ab8b04a6.tar.xz
linux-dev-f63ed6cf93014c7fac56d82069801a26ab8b04a6.zip
staging: r8188eu: add kfree() on an error path of rtw_xmit_resource_alloc()
In rtw_xmit_resource_alloc(), if usb_alloc_urb() fails, then the memory `pxmitbuf->pallocated_buf` which is allocated by kzalloc() is not properly released before returning. So this patch adds kfree() on the above error path to release it in time. Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150 Reviewed-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com> Link: https://lore.kernel.org/r/tencent_3B46EE3287288555389AD2EC3F388827B306@qq.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/r8188eu/core/rtw_xmit.c')
-rw-r--r--drivers/staging/r8188eu/core/rtw_xmit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r8188eu/core/rtw_xmit.c
index 98864fc55b25..13ecd108c86b 100644
--- a/drivers/staging/r8188eu/core/rtw_xmit.c
+++ b/drivers/staging/r8188eu/core/rtw_xmit.c
@@ -44,8 +44,10 @@ static int rtw_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *px
pxmitbuf->dma_transfer_addr = 0;
pxmitbuf->pxmit_urb = usb_alloc_urb(0, GFP_KERNEL);
- if (!pxmitbuf->pxmit_urb)
+ if (!pxmitbuf->pxmit_urb) {
+ kfree(pxmitbuf->pallocated_buf);
return _FAIL;
+ }
return _SUCCESS;
}