]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/bluetooth/hci_event.c
Merge branch 'for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[linux.git] / net / bluetooth / hci_event.c
index 609fd6871c5ad2f060bd191fb3f04cc785bb5392..9e4fcf406d9cd773e02b62998eb1cf387e3e622d 100644 (file)
@@ -3404,6 +3404,12 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb,
        hci_req_cmd_complete(hdev, *opcode, *status, req_complete,
                             req_complete_skb);
 
+       if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) {
+               bt_dev_err(hdev,
+                          "unexpected event for opcode 0x%4.4x", *opcode);
+               return;
+       }
+
        if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q))
                queue_work(hdev->workqueue, &hdev->cmd_work);
 }
@@ -3511,6 +3517,12 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb,
                hci_req_cmd_complete(hdev, *opcode, ev->status, req_complete,
                                     req_complete_skb);
 
+       if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) {
+               bt_dev_err(hdev,
+                          "unexpected event for opcode 0x%4.4x", *opcode);
+               return;
+       }
+
        if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q))
                queue_work(hdev->workqueue, &hdev->cmd_work);
 }
@@ -5433,7 +5445,7 @@ static void hci_le_ext_adv_report_evt(struct hci_dev *hdev, struct sk_buff *skb)
                                           ev->data, ev->length);
                }
 
-               ptr += sizeof(*ev) + ev->length + 1;
+               ptr += sizeof(*ev) + ev->length;
        }
 
        hci_dev_unlock(hdev);