CVE-2025-40059: coresight: Fix incorrect handling for return value of devm_kzalloc
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
coresight: Fix incorrect handling for return value of devm_kzalloc
The return value of devm_kzalloc could be an null pointer, use "!desc.pdata" to fix incorrect handling return value of devm_kzalloc.
The Linux kernel CVE team has assigned CVE-2025-40059 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.8 with commit 4277f035d227e829133df284be7e35b7236a5b0f and fixed in 6.12.53 with commit 8c4e7e646d5d9050b374baf5c6bb3a00fb79e206 Issue introduced in 6.8 with commit 4277f035d227e829133df284be7e35b7236a5b0f and fixed in 6.17.3 with commit 9688b66d0a5e0eecf44f6286b8d9f7a161264035 Issue introduced in 6.8 with commit 4277f035d227e829133df284be7e35b7236a5b0f and fixed in 6.18-rc1 with commit 70714eb7243eaf333d23501d4c7bdd9daf011c01
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-2025-40059
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:
drivers/hwtracing/coresight/coresight-trbe.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/8c4e7e646d5d9050b374baf5c6bb3a00fb79e206 https://git.kernel.org/stable/c/9688b66d0a5e0eecf44f6286b8d9f7a161264035 https://git.kernel.org/stable/c/70714eb7243eaf333d23501d4c7bdd9daf011c01