Skip to contentSkip to conversation

CVE-2026-97923: tracing: Free histogram the var ref when its initialization fails

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Sep 25

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

tracing: Free histogram the var ref when its initialization fails

create_var_ref() allocates a VAR_REF hist_field and then calls init_var_ref() to fill it in. When that fails the field is leaked.

commit 656fe2ba85e8 ("tracing: Use hist trigger's var_ref array to destroy var_refs") made destroy_hist_field() return early for HIST_FIELD_FL_VAR_REF, since var refs are freed by walking the trigger's var_refs[] array instead. create_var_ref() adds the field to that array only after init_var_ref() has succeeded, so on this path the field is in neither place and nothing frees it. The call was correct when it was written, before var refs were taken out of destroy_hist_field().

init_var_ref() cannot free it either. The caller owns the field, so init_var_ref() undoes only its own string allocations and leaves the field alone. Freeing it there would leave create_var_ref() passing freed memory to destroy_hist_field(), which reads its flags.

Call __destroy_hist_field(), which frees the field without consulting the flag.

The Linux kernel CVE team has assigned CVE-2026-97923 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.0 with commit 656fe2ba85e81d00e4447bf77b8da2be3c47acb2 and fixed in 6.12.111 with commit 74375caa20fe5165807b4334c783d1790b01f02a
	Issue introduced in 5.0 with commit 656fe2ba85e81d00e4447bf77b8da2be3c47acb2 and fixed in 6.18.53 with commit 222abcbe7866fef04563b6eb89fb21f627dcbc77
	Issue introduced in 5.0 with commit 656fe2ba85e81d00e4447bf77b8da2be3c47acb2 and fixed in 7.2.7 with commit a69baeac38677270656e85753d93856a076dee57
	Issue introduced in 5.0 with commit 656fe2ba85e81d00e4447bf77b8da2be3c47acb2 and fixed in 7.3-rc3 with commit 516001d53e6b2ea95a251ee2ef54a1a689a3fd58
	Issue introduced in 4.19.100 with commit 836717841a30d7845cdf9cb806ee0ff3bfa7135a

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-97923

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:
kernel/trace/trace_events_hist.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/74375caa20fe5165807b4334c783d1790b01f02a
	https://git.kernel.org/stable/c/222abcbe7866fef04563b6eb89fb21f627dcbc77
	https://git.kernel.org/stable/c/a69baeac38677270656e85753d93856a076dee57
	https://git.kernel.org/stable/c/516001d53e6b2ea95a251ee2ef54a1a689a3fd58