Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278592
b: refs/heads/master
c: 4f957a7
h: refs/heads/master
v: v3
  • Loading branch information
Brian Gix authored and Gustavo F. Padovan committed Dec 1, 2011
1 parent 96f282b commit 05d2b39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c8eb969071032defb1dc493ae28cf2e2a31193a5
refs/heads/master: 4f957a76014fb63d193cd6c141bdd94aaff3a25e
22 changes: 16 additions & 6 deletions trunk/net/bluetooth/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
return 0;
}

static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send)
{
if (send)
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
&reason);

clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->pend);
mgmt_auth_failed(conn->hcon->hdev, conn->dst, reason);
del_timer(&conn->security_timer);
smp_chan_destroy(conn);
}

static void confirm_work(struct work_struct *work)
{
struct smp_chan *smp = container_of(work, struct smp_chan, confirm);
Expand Down Expand Up @@ -270,8 +282,7 @@ static void confirm_work(struct work_struct *work)
return;

error:
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason), &reason);
smp_chan_destroy(conn);
smp_failure(conn, reason, 1);
}

static void random_work(struct work_struct *work)
Expand Down Expand Up @@ -354,8 +365,7 @@ static void random_work(struct work_struct *work)
return;

error:
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason), &reason);
smp_chan_destroy(conn);
smp_failure(conn, reason, 1);
}

static struct smp_chan *smp_chan_create(struct l2cap_conn *conn)
Expand Down Expand Up @@ -655,6 +665,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
break;

case SMP_CMD_PAIRING_FAIL:
smp_failure(conn, skb->data[0], 0);
reason = 0;
err = -EPERM;
break;
Expand Down Expand Up @@ -700,8 +711,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)

done:
if (reason)
smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
&reason);
smp_failure(conn, reason, 1);

kfree_skb(skb);
return err;
Expand Down

0 comments on commit 05d2b39

Please sign in to comment.