Bluetooth: Fix setting correct security level when initiating SMP
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 18 Sep 2014 08:26:32 +0000 (11:26 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Oct 2014 16:40:16 +0000 (09:40 -0700)
commita13abd32a7164af65cf7570e4dbaf1fb039b6184
tree77431200926d5f2f592d5fa6885f242dbf228b29
parent76ac740ae1e7688d661e3388be193ec70e88c012
Bluetooth: Fix setting correct security level when initiating SMP

commit 5eb596f55cacc2389554a8d7572d90d5e9d4269d upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/bluetooth/smp.c