fs/mbcache: cancel shrink work before destroying the cache
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ c2f3140fe2eceb3a6c1615b2648b9471544881c6 · < d227786ab1119669df4dc333a61510c52047cce4| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
fs/mbcache: cancel shrink work before destroying the cache
mb_cache_destroy() calls shrinker_free() and then frees all cache entries and the cache itself, but it does not cancel the pending c_shrink_work work item first.
If mb_cache_entry_create() schedules c_shrink_work via schedule_work() and the work item is still pending or running when mb_cache_destroy() runs, mb_cache_shrink_worker() will access the cache after its memory has been freed, causing a use-after-free.
This is only reachable by a privileged user (root or CAP_SYS_ADMIN) who can trigger the last put of a mounted ext2/ext4/ocfs2 filesystem.
Cancel the work item with cancel_work_sync() before calling shrinker_free(), ensuring the worker has finished and will not be rescheduled before the cache is torn down.
From the CVE record · Linux
The Linux kernel's mbcache destruction path can free a cache while its shrink work item is pending or running, causing a use-after-free. A privileged user with root or CAP_SYS_ADMIN access can trigger this condition by causing the last put of a mounted ext2, ext4, or ocfs2 filesystem.
Administrators running Linux kernels with the affected mbcache code should check their systems; affected versions were not specified.