staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()
Xiaoke Wang authored
[ Upstream commit 708056fb

 ]

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: default avatarXiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_2B7931B79BA38E22205C5A09EFDF11E48805@qq.com

Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
e6cc39db
Name Last commit Last update
Documentation iio: ABI: Fix wrong format of differential capacitance channel ABI.
LICENSES LICENSES/deprecated: add Zlib license text
arch arm64: dts: imx8mq-librem5: Add bq25895 as max17055's power supply
block blk-throttle: prevent overflow while calculating wait time
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist
crypto crypto: akcipher - default implementation for setting a private key
drivers staging: rtl8723bs: fix a potential memory leak in rtw_init_cmd_priv()
fs btrfs: scrub: try to fix super block errors
include iommu/iova: Fix module config properly
init Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree()
kernel rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE()
lib dyndbg: drop EXPORTed dynamic_debug_exec_queries
mm mm/mmap: undo ->mmap() when arch_validate_flags() fails
net Bluetooth: L2CAP: Fix user-after-free
samples x86: Prepare inline-asm for straight-line-speculation
scripts kbuild: rpm-pkg: fix breakage when V=1 is used
security hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero
sound ASoC: SOF: pci: Change DMI match info to support all Chrome platforms
tools kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT
usr usr/include/Makefile: add linux/nfc.h to the compile-test coverage
virt KVM: SEV: add cache flush to solve SEV cache incoherency issues
.clang-format Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl
.gitattributes .gitattributes: use 'dts' diff driver for dts files
.gitignore kbuild: generate Module.symvers only when vmlinux exists
.mailmap mailmap: add two more addresses of Uwe Kleine-König
COPYING COPYING: state that all contributions really are covered by this file
CREDITS MAINTAINERS: Move Jason Cooper to CREDITS
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y
Kconfig kbuild: ensure full rebuild when the compiler is updated
MAINTAINERS MAINTAINERS: add Amir as xfs maintainer for 5.10.y
Makefile hardening: Remove Clang's enable flag for -ftrivial-auto-var-init=zero
README Drop all 00-INDEX files from Documentation/
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.