riscv: cacheinfo: Fix node reference leak in populate_cache_leaves
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 94f9bf118f1e294b3f2092f8bde02860f5e3ea3f · < bf4a195f063b0a0805c1417f6aad1dd32ea48f0f| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
riscv: cacheinfo: Fix node reference leak in populate_cache_leaves
Currently, the while loop drops the reference to prev in each iteration. If the loop terminates early due to a break, the final of_node_put(np) correctly drops the reference to the current node.
However, if the loop terminates naturally because np == NULL, calling of_node_put(np) is a no-op. This leaves the last valid node stored in prev without its reference dropped, resulting in a node reference leak.
Fix this by changing the final `of_node_put(np)` to `of_node_put(prev)`.
From the CVE record · Linux
The Linux kernel’s RISC-V cacheinfo code can leak a device-tree node reference when its cache-leaf traversal ends naturally. The input does not describe an attacker, an exploitation path, or any authentication or user-interaction requirements.
Engineers running Linux kernels with RISC-V cacheinfo should check whether their kernel includes the fix; affected versions are not specified.