]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: Fix memory leak in hci_req_sync_complete()
authorDmitry Antipov <dmantipov@yandex.ru>
Tue, 2 Apr 2024 11:32:05 +0000 (14:32 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 10 Apr 2024 19:03:44 +0000 (15:03 -0400)
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>
net/bluetooth/hci_request.c

index 00e02138003ecefef75714c950056ced5ccd5fda..efea25eb56ce036364c7325916326b687180bbcf 100644 (file)
@@ -105,8 +105,10 @@ 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);
        }
 }