]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Bluetooth: btmtk: fix URB leak in alloc_mtk_intr_urb error path
authorZhao Dongdong <zhaodongdong@kylinos.cn>
Thu, 4 Jun 2026 11:46:40 +0000 (19:46 +0800)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 11 Jun 2026 18:24:40 +0000 (14:24 -0400)
When btmtk_isopkt_pad() fails, the previously allocated URB is not freed,
leaking the urb structure. Add usb_free_urb() before returning the error.

Fixes: ceac1cb0259d ("Bluetooth: btusb: mediatek: add ISO data transmission functions")
Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btmtk.c

index d7aa5aded6493c0ab1a50596e189509f3b1e903c..02a96342e964f0c45e6c5d722589abe10760959b 100644 (file)
@@ -1074,8 +1074,10 @@ struct urb *alloc_mtk_intr_urb(struct hci_dev *hdev, struct sk_buff *skb,
        if (!urb)
                return ERR_PTR(-ENOMEM);
 
-       if (btmtk_isopkt_pad(hdev, skb))
+       if (btmtk_isopkt_pad(hdev, skb)) {
+               usb_free_urb(urb);
                return ERR_PTR(-EINVAL);
+       }
 
        pipe = usb_sndintpipe(btmtk_data->udev,
                              btmtk_data->isopkt_tx_ep->bEndpointAddress);