Skip to content

Commit 60ce2cf

Browse files
author
wes3
authored
Merge pull request apache#936 from andrzej-kaczmarek/ll-txq-race-fix
nimble/ll: Fix possible race on TX queue
2 parents e83b12c + dda185b commit 60ce2cf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

nimble/controller/src/ble_ll.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,7 @@ ble_ll_tx_pkt_in(void)
711711
uint16_t pb;
712712
struct os_mbuf_pkthdr *pkthdr;
713713
struct os_mbuf *om;
714+
os_sr_t sr;
714715

715716
/* Drain all packets off the queue */
716717
while (STAILQ_FIRST(&g_ble_ll_data.ll_tx_pkt_q)) {
@@ -719,7 +720,9 @@ ble_ll_tx_pkt_in(void)
719720
om = (struct os_mbuf *)((uint8_t *)pkthdr - sizeof(struct os_mbuf));
720721

721722
/* Remove from queue */
723+
OS_ENTER_CRITICAL(sr);
722724
STAILQ_REMOVE_HEAD(&g_ble_ll_data.ll_tx_pkt_q, omp_next);
725+
OS_EXIT_CRITICAL(sr);
723726

724727
/* Strip HCI ACL header to get handle and length */
725728
handle = get_le16(om->om_data);

0 commit comments

Comments
 (0)