Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Wed, 22 Sep 2021 13:49:45 +0000 (21:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 13:04:03 +0000 (14:04 +0100)
commitf0b40bf3e48a5af722b2d60adade5562e481904c
tree9b6cb49d85de8c936fe92cf2844d66df7436f8db
parent310f581f54cb0a3a079fcd1436dca35f39b7ba65
Bluetooth: btmtkuart: fix a memleak in mtk_hci_wmt_sync

[ Upstream commit 3e5f2d90c28f9454e421108554707620bc23269d ]

bdev->evt_skb will get freed in the normal path and one error path
of mtk_hci_wmt_sync, while the other error paths do not free it,
which may cause a memleak. This bug is suggested by a static analysis
tool, please advise.

Fixes: e0b67035a90b ("Bluetooth: mediatek: update the common setup between MT7622 and other devices")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bluetooth/btmtkuart.c