@@ -4038,15 +4038,14 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, void *data,
40384038 * (since for this kind of commands there will not be a command
40394039 * complete event).
40404040 */
4041- if (ev -> status ||
4042- (hdev -> sent_cmd && !bt_cb (hdev -> sent_cmd )-> hci .req_event ))
4041+ if (ev -> status || (hdev -> sent_cmd && !hci_skb_event (hdev -> sent_cmd ))) {
40434042 hci_req_cmd_complete (hdev , * opcode , ev -> status , req_complete ,
40444043 req_complete_skb );
4045-
4046- if ( hci_dev_test_flag ( hdev , HCI_CMD_PENDING )) {
4047- bt_dev_err ( hdev ,
4048- "unexpected event for opcode 0x%4.4x" , * opcode ) ;
4049- return ;
4044+ if ( hci_dev_test_flag ( hdev , HCI_CMD_PENDING )) {
4045+ bt_dev_err ( hdev , "unexpected event for opcode 0x%4.4x" ,
4046+ * opcode );
4047+ return ;
4048+ }
40504049 }
40514050
40524051 if (atomic_read (& hdev -> cmd_cnt ) && !skb_queue_empty (& hdev -> cmd_q ))
@@ -6464,13 +6463,24 @@ static const struct hci_le_ev {
64646463};
64656464
64666465static void hci_le_meta_evt (struct hci_dev * hdev , void * data ,
6467- struct sk_buff * skb )
6466+ struct sk_buff * skb , u16 * opcode , u8 * status ,
6467+ hci_req_complete_t * req_complete ,
6468+ hci_req_complete_skb_t * req_complete_skb )
64686469{
64696470 struct hci_ev_le_meta * ev = data ;
64706471 const struct hci_le_ev * subev ;
64716472
64726473 bt_dev_dbg (hdev , "subevent 0x%2.2x" , ev -> subevent );
64736474
6475+ /* Only match event if command OGF is for LE */
6476+ if (hdev -> sent_cmd &&
6477+ hci_opcode_ogf (hci_skb_opcode (hdev -> sent_cmd )) == 0x08 &&
6478+ hci_skb_event (hdev -> sent_cmd ) == ev -> subevent ) {
6479+ * opcode = hci_skb_opcode (hdev -> sent_cmd );
6480+ hci_req_cmd_complete (hdev , * opcode , 0x00 , req_complete ,
6481+ req_complete_skb );
6482+ }
6483+
64746484 subev = & hci_le_ev_table [ev -> subevent ];
64756485 if (!subev -> func )
64766486 return ;
@@ -6764,8 +6774,8 @@ static const struct hci_ev {
67646774 HCI_EV (HCI_EV_REMOTE_HOST_FEATURES , hci_remote_host_features_evt ,
67656775 sizeof (struct hci_ev_remote_host_features )),
67666776 /* [0x3e = HCI_EV_LE_META] */
6767- HCI_EV_VL (HCI_EV_LE_META , hci_le_meta_evt ,
6768- sizeof (struct hci_ev_le_meta ), HCI_MAX_EVENT_SIZE ),
6777+ HCI_EV_REQ_VL (HCI_EV_LE_META , hci_le_meta_evt ,
6778+ sizeof (struct hci_ev_le_meta ), HCI_MAX_EVENT_SIZE ),
67696779#if IS_ENABLED (CONFIG_BT_HS )
67706780 /* [0x40 = HCI_EV_PHY_LINK_COMPLETE] */
67716781 HCI_EV (HCI_EV_PHY_LINK_COMPLETE , hci_phy_link_complete_evt ,
@@ -6849,11 +6859,12 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
68496859 goto done ;
68506860 }
68516861
6852- if (hdev -> sent_cmd && bt_cb (hdev -> sent_cmd )-> hci .req_event == event ) {
6853- struct hci_command_hdr * cmd_hdr = (void * ) hdev -> sent_cmd -> data ;
6854- opcode = __le16_to_cpu (cmd_hdr -> opcode );
6855- hci_req_cmd_complete (hdev , opcode , status , & req_complete ,
6856- & req_complete_skb );
6862+ /* Only match event if command OGF is not for LE */
6863+ if (hdev -> sent_cmd &&
6864+ hci_opcode_ogf (hci_skb_opcode (hdev -> sent_cmd )) != 0x08 &&
6865+ hci_skb_event (hdev -> sent_cmd ) == event ) {
6866+ hci_req_cmd_complete (hdev , hci_skb_opcode (hdev -> sent_cmd ),
6867+ status , & req_complete , & req_complete_skb );
68576868 req_evt = event ;
68586869 }
68596870
0 commit comments