summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2024-04-02 14:32:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-02 16:17:08 +0200
commit89a32741f4217856066c198a4a7267bcdd1edd67 (patch)
tree9c8506d133b3d41928d61ffdcabaa215f4b1b150
parent04720ea2e6c64459a90ca28570ea78335eccd924 (diff)
downloadlinux-stable-89a32741f4217856066c198a4a7267bcdd1edd67.tar.gz
linux-stable-89a32741f4217856066c198a4a7267bcdd1edd67.tar.bz2
linux-stable-89a32741f4217856066c198a4a7267bcdd1edd67.zip
Bluetooth: Fix memory leak in hci_req_sync_complete()
commit 45d355a926ab40f3ae7bc0b0a00cb0e3e8a5a810 upstream. In 'hci_req_sync_complete()', always free the previous sync request state before assigning reference to a new one. Reported-by: syzbot+39ec16ff6cc18b1d066d@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=39ec16ff6cc18b1d066d Cc: stable@vger.kernel.org Fixes: f60cb30579d3 ("Bluetooth: Convert hci_req_sync family of function to new request API") Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/bluetooth/hci_request.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 76bd6b122724..6b9082c3ccc9 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -107,8 +107,10 @@ static void hci_req_sync_complete(struct hci_dev *hdev, u8 result, u16 opcode,
if (hdev->req_status == HCI_REQ_PEND) {
hdev->req_result = result;
hdev->req_status = HCI_REQ_DONE;
- if (skb)
+ if (skb) {
+ kfree_skb(hdev->req_skb);
hdev->req_skb = skb_get(skb);
+ }
wake_up_interruptible(&hdev->req_wait_q);
}
}