linux-stable/drivers/staging/rtl8723bs
Xiaoke Wang 8db6ca84ee staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()
[ Upstream commit 708056fba7 ]

In rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated
in failure, then `pcmdpriv->cmd_allocated_buf` will be not properly
released. Besides, considering there are only two error paths and the
first one can directly return, so we do not need implicitly jump to the
`exit` tag to execute the error handler.

So this patch added `kfree(pcmdpriv->cmd_allocated_buf);` on the error
path to release the resource and simplified the return logic of
rtw_init_cmd_priv(). As there is no proper device to test with, no runtime
testing was performed.

Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_2B7931B79BA38E22205C5A09EFDF11E48805@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-21 12:39:24 +02:00
..
core staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv() 2022-10-21 12:39:24 +02:00
hal staging: rtl8723bs: remove leftover code for other chips 2022-04-22 16:41:37 +02:00
include staging: rtl8723bs: remove leftover code for other chips 2022-04-22 16:41:37 +02:00
os_dep staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw() 2022-10-21 12:39:24 +02:00
Kconfig staging: rtl8723bs: fix unmet dependency on CRYPTO for CRYPTO_LIB_ARC4 2021-10-30 11:12:50 +02:00
Makefile staging: rtl8723bs: remove empty files 2021-08-10 12:12:19 +02:00
TODO staging: rtl8723bs: remove item from TODO list 2021-06-24 14:43:46 +02:00