Skip to content

Commit e8c5405

Browse files
alwa-nordickartben
authored andcommitted
Bluetooth: Controller: Fix headroom reservation for ISO
Calling `net_buf_reserve` removed any previous reservation, which includes the reservation by hci_ipc to hold the H4 type byte. This resulted in a out-of-bounds net_buf_push in hci_ipc. This commit also enables asserts in hci_ipc in the audio bsim test, which reveal the out-of-bounds write. Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
1 parent 4de2265 commit e8c5405

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

subsys/bluetooth/controller/hci/hci_driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink *sink_ctx,
158158
struct net_buf *buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER);
159159

160160
if (buf) {
161-
/* Reserve space for headers */
162-
net_buf_reserve(buf, SDU_HCI_HDR_SIZE);
161+
/* Increase reserved space for headers */
162+
net_buf_reserve(buf, SDU_HCI_HDR_SIZE + net_buf_headroom(buf));
163163

164164
sdu_buffer->dbuf = buf;
165165
sdu_buffer->size = net_buf_tailroom(buf);

tests/bsim/bluetooth/audio/sysbuild.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC)
2020

2121
set(${NET_APP}_EXTRA_CONF_FILE
2222
${APP_DIR}/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf
23+
${NET_APP_SRC_DIR}/debug_overlay.conf
2324
CACHE INTERNAL ""
2425
)
2526

0 commit comments

Comments
 (0)