Skip to content

Commit d53a165

Browse files
sjancjhedberg
authored andcommitted
Bluetooth: ISO: Move iso dereference after assertion
Make sure assertion is true before dereferencing chan->iso. In extreme case compiler could skip assert check (asume it is always false) if address was already dereferenced. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
1 parent c7ec8b9 commit d53a165

File tree

1 file changed

+3
-1
lines changed
  • subsys/bluetooth/host

1 file changed

+3
-1
lines changed

subsys/bluetooth/host/iso.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void bt_iso_connected(struct bt_conn *iso)
454454

455455
static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason)
456456
{
457-
const uint8_t conn_type = chan->iso->iso.info.type;
457+
uint8_t conn_type;
458458
struct net_buf *buf;
459459

460460
LOG_DBG("%p, reason 0x%02x", chan, reason);
@@ -478,6 +478,8 @@ static void bt_iso_chan_disconnected(struct bt_iso_chan *chan, uint8_t reason)
478478
chan->ops->disconnected(chan, reason);
479479
}
480480

481+
conn_type = chan->iso->iso.info.type;
482+
481483
/* The peripheral does not have the concept of a CIG, so once a CIS
482484
* disconnects it is completely freed by unref'ing it
483485
*/

0 commit comments

Comments
 (0)