Skip to content

Commit

Permalink
Bluetooth: Controller: Fix headroom reservation for ISO
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
alwa-nordic authored and kartben committed Dec 21, 2024
1 parent 4de2265 commit e8c5405
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subsys/bluetooth/controller/hci/hci_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink *sink_ctx,
struct net_buf *buf = bt_buf_get_rx(BT_BUF_ISO_IN, K_FOREVER);

if (buf) {
/* Reserve space for headers */
net_buf_reserve(buf, SDU_HCI_HDR_SIZE);
/* Increase reserved space for headers */
net_buf_reserve(buf, SDU_HCI_HDR_SIZE + net_buf_headroom(buf));

sdu_buffer->dbuf = buf;
sdu_buffer->size = net_buf_tailroom(buf);
Expand Down
1 change: 1 addition & 0 deletions tests/bsim/bluetooth/audio/sysbuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC)

set(${NET_APP}_EXTRA_CONF_FILE
${APP_DIR}/overlay-nrf5340_cpunet_iso-bt_ll_sw_split.conf
${NET_APP_SRC_DIR}/debug_overlay.conf
CACHE INTERNAL ""
)

Expand Down

0 comments on commit e8c5405

Please sign in to comment.