From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: amazingfate Date: Sun, 5 Nov 2023 12:23:48 +0800 Subject: bluetooth: fix some blutooth LE devices not pairing --- net/bluetooth/smp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index f1a9fc0012f0..62c4f3b56d22 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c @@ -2970,8 +2970,11 @@ static int smp_sig_channel(struct l2cap_chan *chan, struct sk_buff *skb) if (code > SMP_CMD_MAX) goto drop; - if (smp && !test_and_clear_bit(code, &smp->allow_cmd)) - goto drop; + if (smp && !test_and_clear_bit(code, &smp->allow_cmd)) { + bt_dev_warn(hcon->hdev, "test_and_clear_bit failed with command code 0x%2.2x", code); + if ((code != SMP_CMD_ENCRYPT_INFO) && (code != SMP_CMD_INITIATOR_IDENT)) + goto drop; + } /* If we don't have a context the only allowed commands are * pairing request and security request. -- Armbian