]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: btmtk: fix urb->setup_packet leak in error paths
authorJiajia Liu <liujiajia@kylinos.cn>
Mon, 18 May 2026 02:24:02 +0000 (10:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jun 2026 15:46:32 +0000 (17:46 +0200)
[ Upstream commit dd1dda6b8d6e1f4376a5b3055a04f0ecbdb4d6bd ]

The setup_packet of control urb is not freed if usb_submit_urb fails or
the submitted urb is killed. Add free in these two paths.

Fixes: a1c49c434e150 ("Bluetooth: btusb: Add protocol support for MediaTek MT7668U USB devices")
Signed-off-by: Jiajia Liu <liujiajia@kylinos.cn>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/bluetooth/btmtk.c

index 98cb8529d8bcd4824a0b0dccf539c4c49d68bcea..08a8c3a5d7b7d0d02f4b2c036f6c26dd116e09fb 100644 (file)
@@ -496,6 +496,7 @@ static void btmtk_usb_wmt_recv(struct urb *urb)
                return;
        } else if (urb->status == -ENOENT) {
                /* Avoid suspend failed when usb_kill_urb */
+               kfree(urb->setup_packet);
                return;
        }
 
@@ -569,6 +570,7 @@ static int btmtk_usb_submit_wmt_recv_urb(struct hci_dev *hdev)
                if (err != -EPERM && err != -ENODEV)
                        bt_dev_err(hdev, "urb %p submission failed (%d)",
                                   urb, -err);
+               kfree(dr);
                usb_unanchor_urb(urb);
        }