CVE-2026-138890: ocfs2: free replay slots in ocfs2_recovery_exit()
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: free replay slots in ocfs2recoveryexit()
Commit ce2fcf1516d6 ("ocfs2: fix memory leak in ocfs2mountvolume()") added ocfs2freereplayslots() calls to the mount error paths outdismount and outcheckvolume to fix a leak of osb->replaymap. However these calls are unlocked while the bail path of the recovery thread, which is woken up by outdismount right before the call, also frees the replay slots under osb->recoverylock. Both sides can thus observe a non-NULL osb->replaymap and trigger a double free.
Fix this by moving ocfs2freereplayslots() into ocfs2recoveryexit() after ocfs2recoverydisable(), which waits for a running recovery thread to exit under osb->recoverylock, and drop the unlocked call sites. Both ocfs2dismountvolume() and the outsuper path of ocfs2fillsuper() call ocfs2recoveryexit(), so the replay slots are freed on every path. Since super.c no longer references it, make ocfs2freereplayslots() static again.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.5 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.275 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.63 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1Fixed in 7.3.4-1
Event History
Frequently Asked Questions
When can the double free occur?
It can occur on OCFS2 mount error paths when replay slots are freed without holding recovery_lock while the recovery thread, awakened during dismount, also frees the same non-NULL replay_map under that lock.
Which lifecycle paths are intended to clean up replay slots after the fix?
The fix centralizes cleanup in ocfs2_recovery_exit() after ocfs2_recovery_disable() has waited for any running recovery thread to exit. Both ocfs2_dismount_volume() and the out_super path of ocfs2_fill_super() invoke ocfs2_recovery_exit().
What is the immediate mitigation indicated by the fix if affected code must be maintained?
Avoid freeing replay slots from the unlocked mount-error paths. Cleanup must occur through ocfs2_recovery_exit() only after recovery has been disabled and any running recovery thread has exited.