Skip to content

Commit 94f14e4

Browse files
Johan Hedbergholtmann
authored andcommitted
Bluetooth: SMP: Fix trying to use non-existent local OOB data
A remote device may claim that it has received our OOB data, even though we never geneated it. Add a new flag to track whether we actually have OOB data, and ignore the remote peer's flag if haven't generated OOB data. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 7c5cca3 commit 94f14e4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/bluetooth/smp.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ enum {
8383

8484
struct smp_dev {
8585
/* Secure Connections OOB data */
86+
bool local_oob;
8687
u8 local_pk[64];
8788
u8 local_rand[16];
8889
bool debug_key;
@@ -599,6 +600,8 @@ int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16])
599600

600601
memcpy(rand, smp->local_rand, 16);
601602

603+
smp->local_oob = true;
604+
602605
return 0;
603606
}
604607

@@ -1785,7 +1788,7 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
17851788
* successfully received our local OOB data - therefore set the
17861789
* flag to indicate that local OOB is in use.
17871790
*/
1788-
if (req->oob_flag == SMP_OOB_PRESENT)
1791+
if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
17891792
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
17901793

17911794
/* SMP over BR/EDR requires special treatment */
@@ -1967,7 +1970,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
19671970
* successfully received our local OOB data - therefore set the
19681971
* flag to indicate that local OOB is in use.
19691972
*/
1970-
if (rsp->oob_flag == SMP_OOB_PRESENT)
1973+
if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
19711974
set_bit(SMP_FLAG_LOCAL_OOB, &smp->flags);
19721975

19731976
smp->prsp[0] = SMP_CMD_PAIRING_RSP;
@@ -3230,6 +3233,7 @@ static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)
32303233
return ERR_CAST(tfm_ecdh);
32313234
}
32323235

3236+
smp->local_oob = false;
32333237
smp->tfm_aes = tfm_aes;
32343238
smp->tfm_cmac = tfm_cmac;
32353239
smp->tfm_ecdh = tfm_ecdh;

0 commit comments

Comments
 (0)