Skip to content

Commit 6e6d92f

Browse files
committed
Bluetooth: Controller: Fix empty PDU buffer overrun under ISR latency
Only 3 bytes (PDU_EM_LL_SIZE_MAX) is required for empty PDU transmission, but in case of Radio ISR latency if rx packet pointer is not setup then Radio DMA will use previously assigned buffer which can be this empty PDU buffer. Radio DMA will overrun this buffer and cause memory corruption. Any detection of ISR latency will not happen if the ISR function pointer in RAM is corrupted by this overrun. Increasing ISR latencies in OS and CPU usage in the ULL_HIGH priority if it is same as LLL priority in Controller implementation then it is making it tight to execute Controller code in the tIFS between Tx-Rx PDU's Radio ISRs. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 0951a42 commit 6e6d92f

File tree

1 file changed

+13
-1
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio

1 file changed

+13
-1
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,19 @@ uint32_t radio_crc_is_valid(void)
664664
return (NRF_RADIO->CRCSTATUS != 0);
665665
}
666666

667-
static uint8_t MALIGN(4) _pkt_empty[PDU_EM_LL_SIZE_MAX];
667+
/* Note: Only 3 bytes (PDU_EM_LL_SIZE_MAX) is required for empty PDU
668+
* transmission, but in case of Radio ISR latency if rx packet pointer
669+
* is not setup then Radio DMA will use previously assigned buffer which
670+
* can be this empty PDU buffer. Radio DMA will overrun this buffer and
671+
* cause memory corruption. Any detection of ISR latency will not happen
672+
* if the ISR function pointer in RAM is corrupted by this overrun.
673+
* Increasing ISR latencies in OS and CPU usage in the ULL_HIGH priority
674+
* if it is same as LLL priority in Controller implementation then it is
675+
* making it tight to execute Controller code in the tIFS between Tx-Rx
676+
* PDU's Radio ISRs.
677+
*/
678+
static uint8_t MALIGN(4) _pkt_empty[MAX(HAL_RADIO_PDU_LEN_MAX,
679+
PDU_EM_LL_SIZE_MAX)];
668680
static uint8_t MALIGN(4) _pkt_scratch[MAX((HAL_RADIO_PDU_LEN_MAX + 3),
669681
PDU_AC_LL_SIZE_MAX)];
670682

0 commit comments

Comments
 (0)