CVE-2022-50469: staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
staging: rtl8723bs: fix potential memory leak in rtw_init_drv_sw()
In rtw_init_drv_sw(), there are various init functions are called to populate the padapter structure and some checks for their return value. However, except for the first one error path, the other five error paths do not properly release the previous allocated resources, which leads to various memory leaks.
This patch fixes them and keeps the success and error separate. Note that these changes keep the form of rtw_init_drv_sw() in "drivers/staging/r8188eu/os_dep/os_intfs.c". As there is no proper device to test with, no runtime testing was performed.
The Linux kernel CVE team has assigned CVE-2022-50469 to this issue.
Affected and fixed versions
===========================
Fixed in 5.15.75 with commit b4573a2bad3c3e2643ef3939079eb7035a30e6ee Fixed in 5.19.17 with commit 6b2052b365f8035ab7f09ac24b5b499002b298cb Fixed in 6.0.3 with commit d95d1526d9f06978c1a7186810a5490d72c62742 Fixed in 6.1 with commit 5a5aa9cce621e2c0e25a1e5d72d6be1749167cc0
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2022-50469
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/staging/rtl8723bs/os_dep/os_intfs.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/b4573a2bad3c3e2643ef3939079eb7035a30e6ee https://git.kernel.org/stable/c/6b2052b365f8035ab7f09ac24b5b499002b298cb https://git.kernel.org/stable/c/d95d1526d9f06978c1a7186810a5490d72c62742 https://git.kernel.org/stable/c/5a5aa9cce621e2c0e25a1e5d72d6be1749167cc0