CVE-2026-31559: LoongArch: Fix missing NULL checks for kstrdup()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
LoongArch: Fix missing NULL checks for kstrdup()
1. Replace "of_find_node_by_path("/")" with "of_root" to avoid multiple calls to "of_node_put()".
2. Fix a potential kernel oops during early boot when memory allocation fails while parsing CPU model from device tree.
The Linux kernel CVE team has assigned CVE-2026-31559 to this issue.
Affected and fixed versions
===========================
Fixed in 6.12.80 with commit 5e7fde2c551f86e6c3de3fd7a9b1f52806ac8db0 Fixed in 6.18.21 with commit a1da957c25cf751a2dce8fb7777f82ccbac0cb3e Fixed in 6.19.11 with commit b61a309743322fb57fb9afa9aa3495ac758e4f5e Fixed in 7.0 with commit 3a28daa9b7d7c2ddf2c722e9e95d7e0928bf0cd1
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-31559
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
arch/loongarch/kernel/env.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/5e7fde2c551f86e6c3de3fd7a9b1f52806ac8db0 https://git.kernel.org/stable/c/a1da957c25cf751a2dce8fb7777f82ccbac0cb3e https://git.kernel.org/stable/c/b61a309743322fb57fb9afa9aa3495ac758e4f5e https://git.kernel.org/stable/c/3a28daa9b7d7c2ddf2c722e9e95d7e0928bf0cd1