Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Fix setting correct security level when initiating SMP

We can only determine the final security level when both pairing request
and response have been exchanged. When initiating pairing the starting
target security level is set to MEDIUM unless explicitly specified to be
HIGH, so that we can still perform pairing even if the remote doesn't
have MITM capabilities. However, once we've received the pairing
response we should re-consult the remote and local IO capabilities and
upgrade the target security level if necessary.

Without this patch the resulting Long Term Key will occasionally be
reported to be unauthenticated when it in reality is an authenticated
one.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org

authored by

Johan Hedberg and committed by
Marcel Holtmann
5eb596f5 0097db06

+4 -1
+4 -1
net/bluetooth/smp.c
··· 494 494 } 495 495 496 496 /* Not Just Works/Confirm results in MITM Authentication */ 497 - if (method != JUST_CFM) 497 + if (method != JUST_CFM) { 498 498 set_bit(SMP_FLAG_MITM_AUTH, &smp->flags); 499 + if (hcon->pending_sec_level < BT_SECURITY_HIGH) 500 + hcon->pending_sec_level = BT_SECURITY_HIGH; 501 + } 499 502 500 503 /* If both devices have Keyoard-Display I/O, the master 501 504 * Confirms and the slave Enters the passkey.