CVE-2026-64297: module: decompress: check return value of module_extend_max_pages()

Greg Kroah-Hartman <[email protected]> Sat, 25 Jul 2026 10:48:34 +0200
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026072506-CVE-2026-64297-5945@gregkh>
From: Greg Kroah-Hartman <[email protected]>

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

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

module: decompress: check return value of module_extend_max_pages()

module_extend_max_pages() calls kvrealloc() internally and returns
-ENOMEM on allocation failure. The return value is never checked.

If the initial allocation fails, info->pages remains NULL and
info->max_pages remains 0. Subsequent calls to module_get_next_page()
will attempt to dynamically grow the array by calling
module_extend_max_pages(info, 0) since info->used_pages is 0. This
results in kvrealloc(NULL, 0) returning ZERO_SIZE_PTR, which is treated
as a success, leading to a dereference of ZERO_SIZE_PTR and a kernel
oops.

Fix: add the missing error check after module_extend_max_pages() and
return immediately on failure. This matches the pattern used by every
other kvrealloc() caller in the module loading path.

[Sami: Corrected the analysis in the commit message.]

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


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

	Issue introduced in 5.17 with commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7 and fixed in 6.1.178 with commit e7f174715f9f0cbcb9e87b52e4fc4ef149baac98
	Issue introduced in 5.17 with commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7 and fixed in 6.6.145 with commit afcc0515bbdd28d509a2b5870faaa89b137f5d53
	Issue introduced in 5.17 with commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7 and fixed in 6.12.96 with commit 168072baf9ad516d5a06046514c7fea4c0671990
	Issue introduced in 5.17 with commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7 and fixed in 6.18.39 with commit a82e170637e050a803b4f37542371ef216bf66d2
	Issue introduced in 5.17 with commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7 and fixed in 7.1.4 with commit e7da02659c229f73492fb1ed87ceda4090153aaa
	Issue introduced in 5.17 with commit b1ae6dc41eaaa98bb75671e0f3665bfda248c3e7 and fixed in 7.2-rc1 with commit 786d2d84416a9a1c1a47b71a68d679d886284be2

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-64297
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/module/decompress.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/e7f174715f9f0cbcb9e87b52e4fc4ef149baac98
	https://git.kernel.org/stable/c/afcc0515bbdd28d509a2b5870faaa89b137f5d53
	https://git.kernel.org/stable/c/168072baf9ad516d5a06046514c7fea4c0671990
	https://git.kernel.org/stable/c/a82e170637e050a803b4f37542371ef216bf66d2
	https://git.kernel.org/stable/c/e7da02659c229f73492fb1ed87ceda4090153aaa
	https://git.kernel.org/stable/c/786d2d84416a9a1c1a47b71a68d679d886284be2