]> git.hungrycats.org Git - linux/commitdiff
Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR
authorZijun Hu <quic_zijuhu@quicinc.com>
Tue, 9 Jan 2024 11:03:23 +0000 (19:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Mar 2024 14:38:46 +0000 (14:38 +0000)
[ Upstream commit 61a5ab72edea7ebc3ad2c6beea29d966f528ebfb ]

hci_store_wake_reason() wrongly parses event HCI_Connection_Request
as HCI_Connection_Complete and HCI_Connection_Complete as
HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
potential stability issue, fix it by using the correct field.

Fixes: 2f20216c1d6f ("Bluetooth: Emit controller suspend and resume events")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_event.c

index 2ad2f4647847c939314bfaa048fadbf712be45eb..c4a35d4612b057c2ea0cf8565f3485fb12e3d408 100644 (file)
@@ -6272,10 +6272,10 @@ static void hci_store_wake_reason(struct hci_dev *hdev, u8 event,
         * keep track of the bdaddr of the connection event that woke us up.
         */
        if (event == HCI_EV_CONN_REQUEST) {
-               bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
+               bacpy(&hdev->wake_addr, &conn_request->bdaddr);
                hdev->wake_addr_type = BDADDR_BREDR;
        } else if (event == HCI_EV_CONN_COMPLETE) {
-               bacpy(&hdev->wake_addr, &conn_request->bdaddr);
+               bacpy(&hdev->wake_addr, &conn_complete->bdaddr);
                hdev->wake_addr_type = BDADDR_BREDR;
        } else if (event == HCI_EV_LE_META) {
                struct hci_ev_le_meta *le_ev = (void *)skb->data;