esp_ringbuf: Fix assertion xQueueGenericSend queue.c:818

The release of the semaphore indicating the item was successfully sent must be the last semaphore released.  The receiver may be in another task and may delete the Ringbuffer (such as with a return code across tasks design pattern) if they are through with the Ringbuffer.

The function xRingbufferSendAcquire followed by xRingbufferSendComplete had the semaphores released in the proper order and that same pattern should have been used in xRingbufferSend and xRingbufferSendFromISR.  This commit fixes this order.

Issue (IDFGH-6030) #7716 describes the problem in more detail.

Closes IDFGH-6030, https://github.com/espressif/esp-idf/issues/7716
Closes IDFGH-6036, https://github.com/espressif/esp-idf/pull/7721
This commit is contained in:
RichFalk
2021-10-17 20:58:00 -07:00
committed by Sudeep Mohanty
parent 8037e2462f
commit 1222f6dd3a
2 changed files with 11 additions and 20 deletions

View File

@@ -879,7 +879,6 @@ components/esp_pm/pm_locks.c
components/esp_pm/pm_trace.c
components/esp_pm/test/test_pm.c
components/esp_ringbuf/include/freertos/ringbuf.h
components/esp_ringbuf/ringbuf.c
components/esp_ringbuf/test/test_ringbuf.c
components/esp_rom/esp32/esp_rom_caps.h
components/esp_rom/esp32/ld/esp32.rom.api.ld