Linux kernel use-after-free in OCFS2 recovery during unmount
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Original description
In the Linux kernel, the following vulnerability has been resolved:
ocfs2: stop recovery before shutting down local allocators
Recovery completion needs the local allocators until it has finished reclaiming a failed node's allocation window and truncate log. During unmount, quota recovery is stopped first, but that leaves recovery_state at OCFS2_REC_QUOTA_DISABLED. New non-quota recovery can still start.
ocfs2_truncate_log_shutdown() drains existing completion work and releases osb_tl_bh before ocfs2_recovery_exit() closes that publication path:
Unmount Recovery ------- -------- stop quota recovery; disable quotas truncate_log_shutdown() flush existing completion work recover another failed node queue completion flush local log; release buffer complete_truncate_log_recovery() use released osb_tl_bh recovery_exit(): disable and drain
An extra buffer reference alone would still let completion append new records after the final truncate-log flush.
Split stopping and draining recovery from freeing its state. Stop all recovery producers and drain completion work before shutting down either local allocator. Keep recovery-state release at its existing later point, so its lifetime relative to other teardown users stays unchanged. The second stop at recovery_exit() is harmless once recovery is disabled.
KASAN report as below:
From the CVE record · Linux