Linux kernel use-after-free in OCFS2 DLM handler teardown
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ocfs2/dlm: drain join handlers before releasing module text
The code for a registered DLM handler must remain resident until its last invocation finishes. dlm_unregister_net_handlers() only removes dlm_join_handlers from the o2net registry. o2net_handler_get() takes a kref on the wrapper, but that reference does not pin ocfs2_dlm text. o2net_process_message() calls nh_func after dropping o2net_handler_lock.
With CONFIG_OCFS2_FS_O2CB=m, ocfs2_dlm can be loaded independently of ocfs2_stack_o2cb while nodemanager continues handling messages from a configured, heartbeating peer. If no dependent module or module reference prevents normal unload, the following ordering is possible:
Receive worker Module unload -------------- ------------- o2net_handler_get() take wrapper kref drop handler lock <preempted> dlm_exit() unregister handlers release DLM module text call saved nh_func in released module text
Use o2net_unregister_and_flush_handler_list() in the shared DLM unregister helper. It first prevents new lookups, then waits for the ordered o2net workqueue to drain, including a concurrent destruction of that queue. The acquired invocation therefore finishes before dlm_exit() returns and the loader releases the callback code. The same helper covers partial registration and dlm_init() error unwind before module memory is released.
Skip the drain when the private join-handler list is empty. Early dlm_init() failures can reach this helper before any handler has been published. Partial-registration failure also reaches it a second time after the first call has already unregistered and drained the list. Neither case needs to take o2net_wq_mutex or drain unrelated work. The list is changed only by serialized module init/exit paths; a nonempty list still uses the full unregister-and-flush helper.
Oops report as below:
From the CVE record · Linux
The Linux kernel's ocfs2 DLM can release handler code while a network receive worker is about to call it, potentially causing a kernel crash. This requires ocfs2_dlm to be unloadable while nodemanager handles a message from a configured, heartbeating peer; the input does not specify authentication or user-interaction requirements.
Operators running Linux kernels with ocfs2 DLM, particularly with CONFIG_OCFS2_FS_O2CB=m, should check their kernel's status; affected versions are not specified.