Skip to content

Commit 74098a0

Browse files
committed
Fixed race condition on CDC buffer size
1 parent 97142f5 commit 74098a0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

firmware/usb_cdc/usb_endp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ uint32_t USB_Data_Get(uint8_t **data)
100100
*data = circ_buf[head].pbuf;
101101
len = circ_buf[head].len;
102102
head = (head + 1) % CIRC_BUF_SIZE;
103+
__disable_irq();
103104
size--;
105+
__enable_irq();
104106

105107
return len;
106108
}

0 commit comments

Comments
 (0)