Bluetooth: ISO: Add check for can_send in bt_iso_chan_send

Ensure that we don't attempt to send any data to the
controller if `can_send` is not set, and return an
error code to the application instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-01-21 10:27:58 +01:00 committed by Carles Cufí
parent 24e38e90db
commit f67e12ae8e

View file

@ -696,6 +696,10 @@ int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf)
}
iso_conn = chan->iso;
if (!iso_conn->iso.can_send) {
BT_DBG("Channel not able to send");
return -EINVAL;
}
hdr = net_buf_push(buf, sizeof(*hdr));
hdr->sn = sys_cpu_to_le16(iso_conn->iso.seq_num);