diff mbox series

Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb

Message ID 20200823074421.20769-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New, archived
Headers show
Series Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb | expand

Commit Message

Dinghao Liu Aug. 23, 2020, 7:44 a.m. UTC
When kmalloc() on buf fails, urb should be freed just like
when kmalloc() on dr fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/bluetooth/btusb.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Marcel Holtmann Aug. 31, 2020, 4:04 p.m. UTC | #1
Hi Dinghao,

> When kmalloc() on buf fails, urb should be freed just like
> when kmalloc() on dr fails.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/bluetooth/btusb.c | 1 +
> 1 file changed, 1 insertion(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8d2608ddfd08..f88968bcdd6a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2896,6 +2896,7 @@  static int btusb_mtk_submit_wmt_recv_urb(struct hci_dev *hdev)
 	buf = kmalloc(size, GFP_KERNEL);
 	if (!buf) {
 		kfree(dr);
+		usb_free_urb(urb);
 		return -ENOMEM;
 	}