diff options
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 16ef0dc85a0a..8c225ef349cd 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -267,10 +267,10 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send) | |||
267 | mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type, | 267 | mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type, |
268 | hcon->dst_type, reason); | 268 | hcon->dst_type, reason); |
269 | 269 | ||
270 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) { | 270 | cancel_delayed_work_sync(&conn->security_timer); |
271 | cancel_delayed_work_sync(&conn->security_timer); | 271 | |
272 | if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) | ||
272 | smp_chan_destroy(conn); | 273 | smp_chan_destroy(conn); |
273 | } | ||
274 | } | 274 | } |
275 | 275 | ||
276 | #define JUST_WORKS 0x00 | 276 | #define JUST_WORKS 0x00 |
@@ -579,8 +579,11 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
579 | 579 | ||
580 | if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) | 580 | if (!test_and_set_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags)) |
581 | smp = smp_chan_create(conn); | 581 | smp = smp_chan_create(conn); |
582 | else | ||
583 | smp = conn->smp_chan; | ||
582 | 584 | ||
583 | smp = conn->smp_chan; | 585 | if (!smp) |
586 | return SMP_UNSPECIFIED; | ||
584 | 587 | ||
585 | smp->preq[0] = SMP_CMD_PAIRING_REQ; | 588 | smp->preq[0] = SMP_CMD_PAIRING_REQ; |
586 | memcpy(&smp->preq[1], req, sizeof(*req)); | 589 | memcpy(&smp->preq[1], req, sizeof(*req)); |
@@ -757,9 +760,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
757 | return 0; | 760 | return 0; |
758 | } | 761 | } |
759 | 762 | ||
760 | int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level) | 763 | int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) |
761 | { | 764 | { |
762 | struct hci_conn *hcon = conn->hcon; | 765 | struct l2cap_conn *conn = hcon->l2cap_data; |
763 | struct smp_chan *smp = conn->smp_chan; | 766 | struct smp_chan *smp = conn->smp_chan; |
764 | __u8 authreq; | 767 | __u8 authreq; |
765 | 768 | ||