All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb
@ 2020-08-23  7:44 Dinghao Liu
  2020-08-31 16:04 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Dinghao Liu @ 2020-08-23  7:44 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Marcel Holtmann, Johan Hedberg, linux-bluetooth, linux-kernel

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(+)

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;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb
  2020-08-23  7:44 [PATCH] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb Dinghao Liu
@ 2020-08-31 16:04 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-08-31 16:04 UTC (permalink / raw)
  To: Dinghao Liu; +Cc: kjlu, Johan Hedberg, linux-bluetooth, linux-kernel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-31 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23  7:44 [PATCH] Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb Dinghao Liu
2020-08-31 16:04 ` Marcel Holtmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.