mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 04:41:26 +04:00
FeliCa anti-collision fix (#3889)
* System code added to felica hal config functions * Felica sensf_res setup logic adjusted with new struct * Set api symbols version to 73.0 * Felica unit tests fix * Furi: prevent use after free on xEventGroupSetBits call Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -48,7 +48,9 @@ uint32_t furi_event_flag_set(FuriEventFlag* instance, uint32_t flags) {
|
||||
portYIELD_FROM_ISR(yield);
|
||||
}
|
||||
} else {
|
||||
vTaskSuspendAll();
|
||||
rflags = xEventGroupSetBits(hEventGroup, (EventBits_t)flags);
|
||||
(void)xTaskResumeAll();
|
||||
}
|
||||
|
||||
/* Return event flags after setting */
|
||||
|
||||
@@ -26,10 +26,15 @@ void furi_event_flag_free(FuriEventFlag* instance);
|
||||
|
||||
/** Set flags
|
||||
*
|
||||
* @param instance pointer to FuriEventFlag
|
||||
* @param[in] flags The flags
|
||||
* @warning result of this function can be flags that you've just asked to
|
||||
* set or not if someone was waiting for them and asked to clear it.
|
||||
* It is highly recommended to read this function and
|
||||
* xEventGroupSetBits source code.
|
||||
*
|
||||
* @return Resulting flags or error (FuriStatus)
|
||||
* @param instance pointer to FuriEventFlag
|
||||
* @param[in] flags The flags to set
|
||||
*
|
||||
* @return Resulting flags(see warning) or error (FuriStatus)
|
||||
*/
|
||||
uint32_t furi_event_flag_set(FuriEventFlag* instance, uint32_t flags);
|
||||
|
||||
|
||||
@@ -45,7 +45,9 @@ static void furi_timer_epilogue(void* context, uint32_t arg) {
|
||||
UNUSED(arg);
|
||||
|
||||
EventGroupHandle_t hEvent = context;
|
||||
vTaskSuspendAll();
|
||||
xEventGroupSetBits(hEvent, TIMER_DELETED_EVENT);
|
||||
(void)xTaskResumeAll();
|
||||
}
|
||||
|
||||
void furi_timer_free(FuriTimer* instance) {
|
||||
@@ -55,11 +57,13 @@ void furi_timer_free(FuriTimer* instance) {
|
||||
TimerHandle_t hTimer = (TimerHandle_t)instance;
|
||||
furi_check(xTimerDelete(hTimer, portMAX_DELAY) == pdPASS);
|
||||
|
||||
StaticEventGroup_t event_container;
|
||||
StaticEventGroup_t event_container = {};
|
||||
EventGroupHandle_t hEvent = xEventGroupCreateStatic(&event_container);
|
||||
furi_check(xTimerPendFunctionCall(furi_timer_epilogue, hEvent, 0, portMAX_DELAY) == pdPASS);
|
||||
|
||||
xEventGroupWaitBits(hEvent, TIMER_DELETED_EVENT, 0, pdTRUE, portMAX_DELAY);
|
||||
furi_check(
|
||||
xEventGroupWaitBits(hEvent, TIMER_DELETED_EVENT, pdFALSE, pdTRUE, portMAX_DELAY) ==
|
||||
TIMER_DELETED_EVENT);
|
||||
vEventGroupDelete(hEvent);
|
||||
|
||||
free(instance);
|
||||
|
||||
Reference in New Issue
Block a user