Skip to content

Commit 339ddaa

Browse files
pks-tholtmann
authored andcommitted
Bluetooth: Fix update of connection state in hci_encrypt_cfm
Starting with the upgrade to v5.8-rc3, I've noticed I wasn't able to connect to my Bluetooth headset properly anymore. While connecting to the device would eventually succeed, bluetoothd seemed to be confused about the current connection state where the state was flapping hence and forth. Bisecting this issue led to commit 3ca44c1 (Bluetooth: Consolidate encryption handling in hci_encrypt_cfm, 2020-05-19), which refactored `hci_encrypt_cfm` to also handle updating the connection state. The commit in question changed the code to call `hci_connect_cfm` inside `hci_encrypt_cfm` and to change the connection state. But with the conversion, we now only update the connection state if a status was set already. In fact, the reverse should be true: the status should be updated if no status is yet set. So let's fix the isuse by reversing the condition. Fixes: 3ca44c1 ("Bluetooth: Consolidate encryption handling in hci_encrypt_cfm") Signed-off-by: Patrick Steinhardt <[email protected]> Acked-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 37adf70 commit 339ddaa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status)
14671467
__u8 encrypt;
14681468

14691469
if (conn->state == BT_CONFIG) {
1470-
if (status)
1470+
if (!status)
14711471
conn->state = BT_CONNECTED;
14721472

14731473
hci_connect_cfm(conn, status);

0 commit comments

Comments
 (0)