lockd, nfsd: RCU-protect nlmsvc_ops dispatch
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 · < 641e5e20852359b8c31149be4598884e30652f60| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
lockd, nfsd: RCU-protect nlmsvc_ops dispatch
nlmsvc_ops is published by nfsd_lockd_init() and cleared by nfsd_lockd_shutdown() with plain stores, while lockd dereferences it unguarded from dispatch sites in fs/lockd/svcsubs.c. The pointer targets nfsd's .rodata and the fopen/fclose callbacks live in nfsd's .text, so a stale load after rmmod nfsd results in either a NULL deref or a module-text use-after-free.
Declare nlmsvc_ops as __rcu, publish via rcu_assign_pointer(), clear via RCU_INIT_POINTER() + synchronize_rcu(). Add a struct module *owner field to nlmsvc_binding and pin the module across indirect calls with try_module_get/module_put. When the binding is torn down, fall back to fput() to avoid leaking struct file references.
From the CVE record · Linux
The Linux kernel's lockd can dereference an unprotected nfsd callback pointer. If nfsd is unloaded while lockd dispatches a call, a stale pointer can cause a NULL dereference or module-text use-after-free. The input does not specify attacker access, authentication, or user-interaction requirements.
Anyone running a Linux kernel with lockd and nfsd should check whether their kernel includes the fix; affected versions are not specified.