of: reserved_mem: avoid post-init UAF when alloc_reserved_mem_array() fails
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:
of: reserved_mem: avoid post-init UAF when alloc_reserved_mem_array() fails
The global pointer 'reserved_mem' continues to reference the reserved_mem_array which lives in __initdata if alloc_reserved_mem_array() fails. of_reserved_mem_lookup() is exported for post-init use, that would dereference freed memory and trigger a use-after-free.
So reset reserved_mem_count to 0 when alloc_reserved_mem_array() fails.
From the CVE record · Linux
The Linux kernel can retain a pointer to freed initialization memory if alloc_reserved_mem_array() fails. A later call to of_reserved_mem_lookup() can trigger a use-after-free; the input does not establish whether an attacker can trigger this or whether authentication or user interaction is required.
Engineers running Linux kernels should check whether their versions include the affected reserved-memory code.