arch/xtensa: esp32(s3)_async_op() using nxsem_wait(), threads may

return early due to signal interruption (EINTR). This makes the
main thread think the async operation is done, but the background
worker thread is still running—risking access to freed memory,
race conditions, crashes or undefined behavior.

Using nxsem_wait_uninterruptible():the main thread waits until the
worker thread finishes, preventing these issues.

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
This commit is contained in:
nuttxs 2025-07-18 17:54:04 +08:00 committed by Xiang Xiao
parent 1e6289b543
commit d1fababfc5
2 changed files with 2 additions and 2 deletions

View file

@ -1732,7 +1732,7 @@ static int esp32_async_op(enum spiflash_op_code_e opcode,
ret = work_queue(LPWORK, &g_work, esp32_spiflash_work, &work_arg, 0);
if (ret == 0)
{
nxsem_wait(&work_arg.sem);
nxsem_wait_uninterruptible(&work_arg.sem);
ret = work_arg.ret;
}

View file

@ -857,7 +857,7 @@ static int esp32s3_async_op(enum spiflash_op_code_e opcode,
ret = work_queue(LPWORK, &g_work, esp32s3_spiflash_work, &work_arg, 0);
if (ret == 0)
{
nxsem_wait(&work_arg.sem);
nxsem_wait_uninterruptible(&work_arg.sem);
ret = work_arg.ret;
}