@@ -3071,6 +3071,19 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb,
*opcode = __le16_to_cpu(ev->opcode);
*status = skb->data[sizeof(*ev)];
+ if (opcode != HCI_OP_RESET && !hci_sent_cmd_data(hdev, *opcode)) {
+ /* Some buggy controllers generate an extra command complete
+ * event for the previous command after a new commend was
+ * already sent, so if the opcode does not match the last sent
+ * command we should ignore this event.
+ *
+ * HCI_OP_RESET is a special case handled in
+ * hci_req_cmd_complete.
+ */
+ bt_dev_err(hdev, "unexpected CC event opcode 0x%4.4x", *opcode);
+ return;
+ }
+
skb_pull(skb, sizeof(*ev));
switch (*opcode) {