1
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:
RebornedBrain
2024-09-10 00:11:53 +03:00
committed by GitHub
parent 78c5dd95d8
commit 5f4f4fcc60
11 changed files with 62 additions and 24 deletions

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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);