diff options
-rw-r--r-- | net/bluetooth/smp.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index fa782d7b495b..4f9662d0fd81 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -467,14 +467,13 @@ static int tk_request(struct l2cap_conn *conn, u8 remote_oob, u8 auth, | |||
467 | return ret; | 467 | return ret; |
468 | } | 468 | } |
469 | 469 | ||
470 | static void smp_confirm(struct smp_chan *smp) | 470 | static u8 smp_confirm(struct smp_chan *smp) |
471 | { | 471 | { |
472 | struct l2cap_conn *conn = smp->conn; | 472 | struct l2cap_conn *conn = smp->conn; |
473 | struct hci_dev *hdev = conn->hcon->hdev; | 473 | struct hci_dev *hdev = conn->hcon->hdev; |
474 | struct crypto_blkcipher *tfm = hdev->tfm_aes; | 474 | struct crypto_blkcipher *tfm = hdev->tfm_aes; |
475 | struct smp_cmd_pairing_confirm cp; | 475 | struct smp_cmd_pairing_confirm cp; |
476 | int ret; | 476 | int ret; |
477 | u8 reason; | ||
478 | 477 | ||
479 | BT_DBG("conn %p", conn); | 478 | BT_DBG("conn %p", conn); |
480 | 479 | ||
@@ -488,19 +487,14 @@ static void smp_confirm(struct smp_chan *smp) | |||
488 | 487 | ||
489 | hci_dev_unlock(hdev); | 488 | hci_dev_unlock(hdev); |
490 | 489 | ||
491 | if (ret) { | 490 | if (ret) |
492 | reason = SMP_UNSPECIFIED; | 491 | return SMP_UNSPECIFIED; |
493 | goto error; | ||
494 | } | ||
495 | 492 | ||
496 | clear_bit(SMP_FLAG_CFM_PENDING, &smp->flags); | 493 | clear_bit(SMP_FLAG_CFM_PENDING, &smp->flags); |
497 | 494 | ||
498 | smp_send_cmd(smp->conn, SMP_CMD_PAIRING_CONFIRM, sizeof(cp), &cp); | 495 | smp_send_cmd(smp->conn, SMP_CMD_PAIRING_CONFIRM, sizeof(cp), &cp); |
499 | 496 | ||
500 | return; | 497 | return 0; |
501 | |||
502 | error: | ||
503 | smp_failure(conn, reason); | ||
504 | } | 498 | } |
505 | 499 | ||
506 | static u8 smp_random(struct smp_chan *smp) | 500 | static u8 smp_random(struct smp_chan *smp) |
@@ -657,8 +651,11 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey) | |||
657 | } | 651 | } |
658 | 652 | ||
659 | /* If it is our turn to send Pairing Confirm, do so now */ | 653 | /* If it is our turn to send Pairing Confirm, do so now */ |
660 | if (test_bit(SMP_FLAG_CFM_PENDING, &smp->flags)) | 654 | if (test_bit(SMP_FLAG_CFM_PENDING, &smp->flags)) { |
661 | smp_confirm(smp); | 655 | u8 rsp = smp_confirm(smp); |
656 | if (rsp) | ||
657 | smp_failure(conn, rsp); | ||
658 | } | ||
662 | 659 | ||
663 | return 0; | 660 | return 0; |
664 | } | 661 | } |
@@ -765,7 +762,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
765 | 762 | ||
766 | /* Can't compose response until we have been confirmed */ | 763 | /* Can't compose response until we have been confirmed */ |
767 | if (test_bit(SMP_FLAG_TK_VALID, &smp->flags)) | 764 | if (test_bit(SMP_FLAG_TK_VALID, &smp->flags)) |
768 | smp_confirm(smp); | 765 | return smp_confirm(smp); |
769 | 766 | ||
770 | return 0; | 767 | return 0; |
771 | } | 768 | } |
@@ -786,7 +783,7 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb) | |||
786 | smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd), | 783 | smp_send_cmd(conn, SMP_CMD_PAIRING_RANDOM, sizeof(smp->prnd), |
787 | smp->prnd); | 784 | smp->prnd); |
788 | else if (test_bit(SMP_FLAG_TK_VALID, &smp->flags)) | 785 | else if (test_bit(SMP_FLAG_TK_VALID, &smp->flags)) |
789 | smp_confirm(smp); | 786 | return smp_confirm(smp); |
790 | else | 787 | else |
791 | set_bit(SMP_FLAG_CFM_PENDING, &smp->flags); | 788 | set_bit(SMP_FLAG_CFM_PENDING, &smp->flags); |
792 | 789 | ||