diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-09-10 20:37:44 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-09-10 20:45:24 -0400 |
commit | 1afc2a1ab6612dcc3f26db7ca1afba9cff359f1c (patch) | |
tree | 732c2a96faeefeb35a72e89c0b1ee3fe8f3ece47 /net/bluetooth/smp.c | |
parent | 24bd0bd94e0947e257c5cd6a85b0e337d953e79c (diff) |
Bluetooth: Fix SMP security level when we have no IO capabilities
When the local IO capability is NoInputNoOutput any attempt to convert
the remote authentication requirement to a target security level is
futile. This patch makes sure that we set the target security level at
most to MEDIUM if the local IO capability is NoInputNoOutput.
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.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index be8371b4eb63..a08b077cb725 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -959,7 +959,11 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
959 | memcpy(&smp->preq[1], req, sizeof(*req)); | 959 | memcpy(&smp->preq[1], req, sizeof(*req)); |
960 | skb_pull(skb, sizeof(*req)); | 960 | skb_pull(skb, sizeof(*req)); |
961 | 961 | ||
962 | sec_level = authreq_to_seclevel(auth); | 962 | if (conn->hcon->io_capability == 0x03) |
963 | sec_level = BT_SECURITY_MEDIUM; | ||
964 | else | ||
965 | sec_level = authreq_to_seclevel(auth); | ||
966 | |||
963 | if (sec_level > conn->hcon->pending_sec_level) | 967 | if (sec_level > conn->hcon->pending_sec_level) |
964 | conn->hcon->pending_sec_level = sec_level; | 968 | conn->hcon->pending_sec_level = sec_level; |
965 | 969 | ||
@@ -1165,7 +1169,11 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
1165 | 1169 | ||
1166 | auth = rp->auth_req & AUTH_REQ_MASK; | 1170 | auth = rp->auth_req & AUTH_REQ_MASK; |
1167 | 1171 | ||
1168 | sec_level = authreq_to_seclevel(auth); | 1172 | if (hcon->io_capability == 0x03) |
1173 | sec_level = BT_SECURITY_MEDIUM; | ||
1174 | else | ||
1175 | sec_level = authreq_to_seclevel(auth); | ||
1176 | |||
1169 | if (smp_sufficient_security(hcon, sec_level)) | 1177 | if (smp_sufficient_security(hcon, sec_level)) |
1170 | return 0; | 1178 | return 0; |
1171 | 1179 | ||