bluetooth: don't assume key size is 16 when the command fails.
Subsystems (2)
PATCH v4 1/1 bluetooth: don't assume key size is 16 when the command fails.
With this change, the encryption key size is not assumed to be 16 if the read_encryption_key_size command fails for any reason. This ensures that if the controller fails the command for any reason that the encryption key size isn't implicitely set to 16 and instead take a more concervative posture to assume it is 0.
---
net/bluetooth/hci_event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/bluetooth/hci_event.c +4 -4
@@ -2963,14 +2963,14 @@ static void read_enc_key_size_complete(struct hci_dev *hdev, u8 status,if (!conn) goto unlock; -/* If we fail to read the encryption key size, assume maximum -* (which is the same we do also when this HCI command isn't -* supported. +/* While unexpected, the read_enc_key_size command may fail. The most +* secure approach is to then assume the key size is 0 to force a +* disconnection. */ if (rp->status) {bt_dev_err (hdev,"failed to read key size for handle %u" , handle); - conn->enc_key_size =HCI_LINK_KEY_SIZE ; + conn->enc_key_size =0 ; }else { conn->enc_key_size = rp->key_size; }
Signature · 1 line
2.25.1.696.g5e7596f4ac-goog
Marcel Holtmann
maintainerHi Alain,
Quoted 6 lines
With this change, the encryption key size is not assumed to be 16 if the
read_encryption_key_sizecommand fails for any reason. This ensures that if the controller fails the command for any reason that the encryption key size isn't implicitely set to 16 and instead take a more concervative posture to assume it is 0.
Quoted 6 lines
Signed-off-by Alain Michaud <[email protected]>---
net/bluetooth/hci_event.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel