]> git.baikalelectronics.ru Git - kernel.git/commit
staging: r8188eu: fix potential memory leak in _rtw_init_xmit_priv()
authorXiaoke Wang <xkernel.wang@foxmail.com>
Tue, 13 Sep 2022 13:24:05 +0000 (21:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 24 Sep 2022 11:08:44 +0000 (13:08 +0200)
commit218afc9496ae127b7ce75b6e6c976b97270cd03e
treebaf836e2652bdffa833370af8908eb963f834888
parent0db8ab8916297d0566e83e3273e2a1b3bc34a21a
staging: r8188eu: fix potential memory leak in _rtw_init_xmit_priv()

In _rtw_init_xmit_priv(), there are several error paths for allocation
failures just jump to the `exit` section. However, there is no action
will be performed, so the allocated resources are not properly released,
which leads to various memory leaks.

To properly release them, this patch unifies the error handling code and
several error handling paths are added.
According to the allocation sequence, if the validation fails, it will
jump to its corresponding error tag to release the resources.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_DB57E4F270F4539485C32B05FDAF8394310A@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_xmit.c