Skip to content

Commit

Permalink
Bluetooth: btusb: Fix memleak in btusb_mtk_submit_wmt_recv_urb
Browse files Browse the repository at this point in the history
[ Upstream commit d33fe77 ]

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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dinghaoliu authored and gregkh committed Oct 29, 2020
1 parent 81f61a5 commit 142043f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/bluetooth/btusb.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 142043f

Please sign in to comment.