mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-12-10 07:14:36 +01:00
fix(async_context_threadsafe_background_execute_sync): prevent use-after-return by removing worker before semaphore release (#2494)
Ensures the async worker is unregistered from the context before releasing the blocking thread. This prevents the `sync_func_call_t` stack object from being accessed after it goes out of scope, avoiding a use-after-return condition in multicore `async_context_execute_sync()` scenarios. Fixes raspberrypi/pico-sdk#2433 Signed-off-by: Goran Mišković <schkovich@users.noreply.github.com>
This commit is contained in:
parent
1ae2f0e32c
commit
a9146b65ad
1 changed files with 1 additions and 1 deletions
|
|
@ -98,8 +98,8 @@ typedef struct sync_func_call{
|
|||
static void handle_sync_func_call(async_context_t *context, async_when_pending_worker_t *worker) {
|
||||
sync_func_call_t *call = (sync_func_call_t *)worker;
|
||||
call->rc = call->func(call->param);
|
||||
sem_release(&call->sem);
|
||||
async_context_remove_when_pending_worker(context, worker);
|
||||
sem_release(&call->sem);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue