mirror of
https://github.com/apache/nuttx.git
synced 2026-03-27 10:39:28 +08:00
Fix a race on userfs_state_s iobuffer. 1. Task 1 takes the mutex and does a userfs operation. 2. A higher priority task 2 blocks on the mutex. 3. Task 1 releases the mutex when finished. The iobuffer response has not been processed by task 1 yet, but task 2 is higher priority and control switches to it. 4. Task 2 does a userfs operation and releases the mutex. The iobuffer now contains task 2's response. 5. Control returns to task 1 for it to check the iobuffer response. It contains task 2's response, not its own. Fix it by releasing the mutex only after the exclusive iobuffer usage lifecycle is complete. Signed-off-by: liamHowatt <liamjmh0@gmail.com>