devkitPro / libfat

FAT library for GBA, DS, Gamecube & Wii
http://devkitpro.org/viewforum.php?f=24
55 stars 36 forks source link

Fix concurrency bugs in FAT_getAttr/FAT_setAttr. #13

Closed Chadderz121 closed 6 years ago

Chadderz121 commented 6 years ago

A relatively rare concurrency bug existed in these methods due to them not correctly holding the partition lock during calls to _FAT_directory_entryFromPath. That method can trigger reads to the partition. Due to the lock not being held, another thread could still trigger a concurrent read, potentially corrupting the cache. The fix is simply to ensure the lock is held around the calls.