fs/userfs: keep lock while reading iobuffer

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>
This commit is contained in:
liamHowatt
2025-12-30 14:05:46 +00:00
committed by Alan C. Assis
parent 8b3862d19b
commit 081c2337b7
+190 -46
View File
File diff suppressed because it is too large Load Diff