@@ -7364,21 +7364,27 @@ static int set_public_address(struct sock *sk, struct hci_dev *hdev,
73647364 return err ;
73657365}
73667366
7367- static void read_local_oob_ext_data_complete (struct hci_dev * hdev , u8 status ,
7368- u16 opcode , struct sk_buff * skb )
7367+ static void read_local_oob_ext_data_complete (struct hci_dev * hdev , void * data ,
7368+ int err )
73697369{
73707370 const struct mgmt_cp_read_local_oob_ext_data * mgmt_cp ;
73717371 struct mgmt_rp_read_local_oob_ext_data * mgmt_rp ;
73727372 u8 * h192 , * r192 , * h256 , * r256 ;
7373- struct mgmt_pending_cmd * cmd ;
7373+ struct mgmt_pending_cmd * cmd = data ;
7374+ struct sk_buff * skb = cmd -> skb ;
7375+ u8 status = mgmt_status (err );
73747376 u16 eir_len ;
7375- int err ;
73767377
7377- bt_dev_dbg (hdev , "status %u" , status );
7378+ if (!status ) {
7379+ if (!skb )
7380+ status = MGMT_STATUS_FAILED ;
7381+ else if (IS_ERR (skb ))
7382+ status = mgmt_status (PTR_ERR (skb ));
7383+ else
7384+ status = mgmt_status (skb -> data [0 ]);
7385+ }
73787386
7379- cmd = pending_find (MGMT_OP_READ_LOCAL_OOB_EXT_DATA , hdev );
7380- if (!cmd )
7381- return ;
7387+ bt_dev_dbg (hdev , "status %u" , status );
73827388
73837389 mgmt_cp = cmd -> param ;
73847390
@@ -7390,7 +7396,7 @@ static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status,
73907396 r192 = NULL ;
73917397 h256 = NULL ;
73927398 r256 = NULL ;
7393- } else if (opcode == HCI_OP_READ_LOCAL_OOB_DATA ) {
7399+ } else if (! bredr_sc_enabled ( hdev ) ) {
73947400 struct hci_rp_read_local_oob_data * rp ;
73957401
73967402 if (skb -> len != sizeof (* rp )) {
@@ -7471,6 +7477,9 @@ static void read_local_oob_ext_data_complete(struct hci_dev *hdev, u8 status,
74717477 mgmt_rp , sizeof (* mgmt_rp ) + eir_len ,
74727478 HCI_MGMT_OOB_DATA_EVENTS , cmd -> sk );
74737479done :
7480+ if (skb && !IS_ERR (skb ))
7481+ kfree_skb (skb );
7482+
74747483 kfree (mgmt_rp );
74757484 mgmt_pending_remove (cmd );
74767485}
@@ -7479,22 +7488,16 @@ static int read_local_ssp_oob_req(struct hci_dev *hdev, struct sock *sk,
74797488 struct mgmt_cp_read_local_oob_ext_data * cp )
74807489{
74817490 struct mgmt_pending_cmd * cmd ;
7482- struct hci_request req ;
74837491 int err ;
74847492
74857493 cmd = mgmt_pending_add (sk , MGMT_OP_READ_LOCAL_OOB_EXT_DATA , hdev ,
74867494 cp , sizeof (* cp ));
74877495 if (!cmd )
74887496 return - ENOMEM ;
74897497
7490- hci_req_init (& req , hdev );
7491-
7492- if (bredr_sc_enabled (hdev ))
7493- hci_req_add (& req , HCI_OP_READ_LOCAL_OOB_EXT_DATA , 0 , NULL );
7494- else
7495- hci_req_add (& req , HCI_OP_READ_LOCAL_OOB_DATA , 0 , NULL );
7498+ err = hci_cmd_sync_queue (hdev , read_local_oob_data_sync , cmd ,
7499+ read_local_oob_ext_data_complete );
74967500
7497- err = hci_req_run_skb (& req , read_local_oob_ext_data_complete );
74987501 if (err < 0 ) {
74997502 mgmt_pending_remove (cmd );
75007503 return err ;
0 commit comments