]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.7/bluetooth-fix-setting-correct-security-level-when-initiating-smp.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.7 / bluetooth-fix-setting-correct-security-level-when-initiating-smp.patch
1 From 5eb596f55cacc2389554a8d7572d90d5e9d4269d Mon Sep 17 00:00:00 2001
2 From: Johan Hedberg <johan.hedberg@intel.com>
3 Date: Thu, 18 Sep 2014 11:26:32 +0300
4 Subject: Bluetooth: Fix setting correct security level when initiating SMP
5
6 From: Johan Hedberg <johan.hedberg@intel.com>
7
8 commit 5eb596f55cacc2389554a8d7572d90d5e9d4269d upstream.
9
10 We can only determine the final security level when both pairing request
11 and response have been exchanged. When initiating pairing the starting
12 target security level is set to MEDIUM unless explicitly specified to be
13 HIGH, so that we can still perform pairing even if the remote doesn't
14 have MITM capabilities. However, once we've received the pairing
15 response we should re-consult the remote and local IO capabilities and
16 upgrade the target security level if necessary.
17
18 Without this patch the resulting Long Term Key will occasionally be
19 reported to be unauthenticated when it in reality is an authenticated
20 one.
21
22 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
23 Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 net/bluetooth/smp.c | 5 ++++-
28 1 file changed, 4 insertions(+), 1 deletion(-)
29
30 --- a/net/bluetooth/smp.c
31 +++ b/net/bluetooth/smp.c
32 @@ -432,8 +432,11 @@ static int tk_request(struct l2cap_conn
33 }
34
35 /* Not Just Works/Confirm results in MITM Authentication */
36 - if (method != JUST_CFM)
37 + if (method != JUST_CFM) {
38 set_bit(SMP_FLAG_MITM_AUTH, &smp->flags);
39 + if (hcon->pending_sec_level < BT_SECURITY_HIGH)
40 + hcon->pending_sec_level = BT_SECURITY_HIGH;
41 + }
42
43 /* If both devices have Keyoard-Display I/O, the master
44 * Confirms and the slave Enters the passkey.