aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/smp.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-07-10 04:02:07 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-07-10 04:23:39 -0400
commitb3c6410b8c75cd48e4242af0173bb55701939b9b (patch)
treee160a7c09d4525e8066394fe57bfdfba14a7a50f /net/bluetooth/smp.c
parente8b1202ce6ab67341660812e7d66db4c3e2a5649 (diff)
Bluteooth: Reject SMP bonding if HCI_PAIRABLE is not set
If the remote device tries to initiate bonding with us and we don't have HCI_PAIRABLE set we should just flat out reject the request. This brings SMP in line with how the flag is used for BR/EDR SSP. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r--net/bluetooth/smp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 627d683203cf..bf3568c46847 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -676,6 +676,7 @@ int smp_user_confirm_reply(struct hci_conn *hcon, u16 mgmt_op, __le32 passkey)
676static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) 676static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
677{ 677{
678 struct smp_cmd_pairing rsp, *req = (void *) skb->data; 678 struct smp_cmd_pairing rsp, *req = (void *) skb->data;
679 struct hci_dev *hdev = conn->hcon->hdev;
679 struct smp_chan *smp; 680 struct smp_chan *smp;
680 u8 key_size, auth, sec_level; 681 u8 key_size, auth, sec_level;
681 int ret; 682 int ret;
@@ -696,6 +697,10 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
696 if (!smp) 697 if (!smp)
697 return SMP_UNSPECIFIED; 698 return SMP_UNSPECIFIED;
698 699
700 if (!test_bit(HCI_PAIRABLE, &hdev->dev_flags) &&
701 (req->auth_req & SMP_AUTH_BONDING))
702 return SMP_PAIRING_NOTSUPP;
703
699 smp->preq[0] = SMP_CMD_PAIRING_REQ; 704 smp->preq[0] = SMP_CMD_PAIRING_REQ;
700 memcpy(&smp->preq[1], req, sizeof(*req)); 705 memcpy(&smp->preq[1], req, sizeof(*req));
701 skb_pull(skb, sizeof(*req)); 706 skb_pull(skb, sizeof(*req));
@@ -911,6 +916,10 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
911 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) 916 if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
912 return 0; 917 return 0;
913 918
919 if (!test_bit(HCI_PAIRABLE, &hcon->hdev->dev_flags) &&
920 (rp->auth_req & SMP_AUTH_BONDING))
921 return SMP_PAIRING_NOTSUPP;
922
914 smp = smp_chan_create(conn); 923 smp = smp_chan_create(conn);
915 if (!smp) 924 if (!smp)
916 return SMP_UNSPECIFIED; 925 return SMP_UNSPECIFIED;