In the Linux kernel, the following vulnerability has been resolved:
netfs/fscache: Add a memory barrier for FSCACHEVOLUMECREATING
In fscachecreatevolume(), there is a missing memory barrier between the bit-clearing operation and the wake-up operation. This may cause a situation where, after a wake-up, the bit-clearing operation hasn't been detected yet, leading to an indefinite wait. The triggering process is as follows:
[cookie1] [cookie2] [volumework] fscacheperformlookup fscachecreatevolume fscacheperformlookup fscachecreatevolume fscachecreatevolumework cachefilesacquirevolume clearandwakeupbit testandsetbit testandsetbit goto maybewait goto nowait
In the above process, cookie1 and cookie2 has the same volume. When cookie1 enters the -no_wait- process, it will clear the bit and wake up the waiting process. If a barrier is missing, it may cause cookie2 to remain in the -wait- process indefinitely.
In commit 3288666c7256 ("fscache: Use clearandwakeupbit() in fscachecreatevolumework()"), barriers were added to similar operations in fscachecreatevolumework(), but fscachecreatevolume() was missed.
By combining the clear and wake operations into clearandwakeupbit() to fix this issue.