Skip to content

Commit 45d355a

Browse files
dmantipovVudentz
authored andcommitted
Bluetooth: Fix memory leak in hci_req_sync_complete()
In 'hci_req_sync_complete()', always free the previous sync request state before assigning reference to a new one. Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d Cc: [email protected] Fixes: f60cb30 ("Bluetooth: Convert hci_req_sync family of function to new request API") Signed-off-by: Dmitry Antipov <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 53cb419 commit 45d355a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/bluetooth/hci_request.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
105105
if (hdev->req_status == HCI_REQ_PEND) {
106106
hdev->req_result = result;
107107
hdev->req_status = HCI_REQ_DONE;
108-
if (skb)
108+
if (skb) {
109+
kfree_skb(hdev->req_skb);
109110
hdev->req_skb = skb_get(skb);
111+
}
110112
wake_up_interruptible(&hdev->req_wait_q);
111113
}
112114
}

0 commit comments

Comments
 (0)