Skip to content

Commit e8a723b

Browse files
Thalleykoffes
authored andcommitted
[nrf fromtree] Bluetooth: CSIP: Fix off-by-one in in lock restore
If the lock request was rejected by a set member we should restore any previously written logs in reverse order. However there was a off-by-one error in csip_set_coordinator_write_lock_cb which caused us to attempt to release member[1] instead of member[0] if member[1] was the one that rejected the lock request. Additionally, the lock_set_complete would be called prematurely before we get the response from the restore request. Signed-off-by: Emil Gydesen <[email protected]> (cherry picked from commit 7c40b07)
1 parent b4833a6 commit e8a723b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

subsys/bluetooth/audio/csip_set_coordinator.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn,
11141114

11151115
active.members_restored = 0;
11161116

1117-
member = active.members[active.members_handled - active.members_restored];
1117+
member = active.members[active.members_handled - 1];
11181118
client->cur_inst = lookup_instance_by_set_info(member, &active.info);
11191119
if (client->cur_inst == NULL) {
11201120
LOG_DBG("Failed to lookup instance by set_info");
@@ -1131,10 +1131,10 @@ static void csip_set_coordinator_write_lock_cb(struct bt_conn *conn,
11311131
active_members_reset();
11321132
return;
11331133
}
1134+
} else {
1135+
lock_set_complete(err);
11341136
}
11351137

1136-
lock_set_complete(err);
1137-
11381138
return;
11391139
}
11401140

0 commit comments

Comments
 (0)