From: Marcel Holtmann Date: Mon, 14 Jul 2008 18:13:45 +0000 (+0200) Subject: [Bluetooth] Update authentication status after successful encryption X-Git-Tag: v2.6.27-rc1~964^2~10^2~22 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;h=ae29319649b80ed9d28d7b4f164e3f5f75020fc8;p=safe%2Fjmp%2Flinux-2.6 [Bluetooth] Update authentication status after successful encryption The authentication status is not communicated to both parties. This is actually a flaw in the Bluetooth specification. Only the requesting side really knows if the authentication was successful or not. This piece of information is however needed on the other side to know if it has to trigger the authentication procedure or not. Worst case is that both sides will request authentication at different times, but this should be avoided since it costs extra time when setting up a new connection. For Bluetooth encryption it is required to authenticate the link first and the encryption status is communicated to both sides. So when a link is switched to encryption it is possible to update the authentication status since it implies an authenticated link. Signed-off-by: Marcel Holtmann --- diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 6aef8f2..0aba21a 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -883,9 +883,11 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff * conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); if (conn) { if (!ev->status) { - if (ev->encrypt) + if (ev->encrypt) { + /* Encryption implies authentication */ + conn->link_mode |= HCI_LM_AUTH; conn->link_mode |= HCI_LM_ENCRYPT; - else + } else conn->link_mode &= ~HCI_LM_ENCRYPT; }