Bluetooth: L2CAP: Use safe for-each loop where channel can be removed
Use safe for-each loop in bt_l2cap_encrypt_change since dynamic channels with pending connection-oriented channel requests will be canceled and removed from the list if the encryption change failed. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
091565e8d3
commit
81e297aa88
1 changed files with 2 additions and 2 deletions
|
@ -542,7 +542,7 @@ static void l2cap_le_encrypt_change(struct bt_l2cap_chan *chan, uint8_t status)
|
|||
|
||||
void bt_l2cap_encrypt_change(struct bt_conn *conn, uint8_t hci_status)
|
||||
{
|
||||
struct bt_l2cap_chan *chan;
|
||||
struct bt_l2cap_chan *chan, *next;
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_BREDR) &&
|
||||
conn->type == BT_CONN_TYPE_BR) {
|
||||
|
@ -550,7 +550,7 @@ void bt_l2cap_encrypt_change(struct bt_conn *conn, uint8_t hci_status)
|
|||
return;
|
||||
}
|
||||
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&conn->channels, chan, node) {
|
||||
SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&conn->channels, chan, next, node) {
|
||||
#if defined(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL)
|
||||
l2cap_le_encrypt_change(chan, hci_status);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue