Bluetooth: btusb: fix memory leak in btusb_mtk_submit_wmt_recv_urb()
authorMark-YW.Chen <mark-yw.chen@mediatek.com>
Wed, 13 Oct 2021 16:22:04 +0000 (00:22 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 13 Oct 2021 16:17:34 +0000 (18:17 +0200)
commit60c6a63a3d3080a62f3e0e20084f58dbeff16748
tree0e2068298e18292b8a043a6be91d04bf335a9456
parent75d9b8559ac36e059238ee4f8e33cd86086586ba
Bluetooth: btusb: fix memory leak in btusb_mtk_submit_wmt_recv_urb()

Driver should free `usb->setup_packet` to avoid the leak.

$ cat /sys/kernel/debug/kmemleak
unreferenced object 0xffffffa564a58080 (size 128):
    backtrace:
        [<000000007eb8dd70>] kmem_cache_alloc_trace+0x22c/0x384
        [<000000008a44191d>] btusb_mtk_hci_wmt_sync+0x1ec/0x994
    [btusb]
        [<00000000ca7189a3>] btusb_mtk_setup+0x6b8/0x13cc
    [btusb]
        [<00000000c6105069>] hci_dev_do_open+0x290/0x974
    [bluetooth]
        [<00000000a583f8b8>] hci_power_on+0xdc/0x3cc [bluetooth]
        [<000000005d80e687>] process_one_work+0x514/0xc80
        [<00000000f4d57637>] worker_thread+0x818/0xd0c
        [<00000000dc7bdb55>] kthread+0x2f8/0x3b8
        [<00000000f9999513>] ret_from_fork+0x10/0x30

Fixes: a1c49c434e150 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
Signed-off-by: Mark-YW.Chen <mark-yw.chen@mediatek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btusb.c