Bluetooth: Classic: SMP: Recovery flag SMP_FLAG_BR_CONNECTED
The flag `SMP_FLAG_BR_CONNECTED` is cleared by the function `smp_br_reset()` and `smp_br_init`. But the flag `SMP_FLAG_BR_CONNECTED` should not be cleared at this time. Recovery the flag `SMP_FLAG_BR_CONNECTED` after the all flags of SMP cleared. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This commit is contained in:
parent
b59bc363ea
commit
f25fe59805
1 changed files with 14 additions and 0 deletions
|
@ -809,11 +809,18 @@ static void sc_derive_link_key(struct bt_smp *smp)
|
|||
|
||||
static void smp_br_reset(struct bt_smp_br *smp)
|
||||
{
|
||||
bool br_smp_connected;
|
||||
|
||||
br_smp_connected = atomic_test_bit(smp->flags, SMP_FLAG_BR_CONNECTED);
|
||||
|
||||
/* Clear flags first in case canceling of timeout fails. The SMP context
|
||||
* shall be marked as timed out in that case.
|
||||
*/
|
||||
atomic_set(smp->flags, 0);
|
||||
|
||||
/* Set back the status of the flag SMP_FLAG_BR_CONNECTED. */
|
||||
atomic_set_bit_to(smp->flags, SMP_FLAG_BR_CONNECTED, br_smp_connected);
|
||||
|
||||
/* If canceling fails the timeout handler will set the timeout flag and
|
||||
* mark the it as timed out. No new pairing procedures shall be started
|
||||
* on this connection if that happens.
|
||||
|
@ -964,11 +971,18 @@ static void bt_smp_br_disconnected(struct bt_l2cap_chan *chan)
|
|||
|
||||
static void smp_br_init(struct bt_smp_br *smp)
|
||||
{
|
||||
bool br_smp_connected;
|
||||
|
||||
br_smp_connected = atomic_test_bit(smp->flags, SMP_FLAG_BR_CONNECTED);
|
||||
|
||||
/* Initialize SMP context excluding L2CAP channel context and anything
|
||||
* else declared after.
|
||||
*/
|
||||
(void)memset(smp, 0, offsetof(struct bt_smp_br, chan));
|
||||
|
||||
/* Set back the status of the flag SMP_FLAG_BR_CONNECTED. */
|
||||
atomic_set_bit_to(smp->flags, SMP_FLAG_BR_CONNECTED, br_smp_connected);
|
||||
|
||||
atomic_set_bit(smp->allowed_cmds, BT_SMP_CMD_PAIRING_FAIL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue