CVE-2026-68285: LoongArch: BPF: Fix memory leak in bpf_jit_free()

Greg Kroah-Hartman <[email protected]>
Newsgroups org.kernel.vger.linux-cve-announce
Message-ID <2026081026-CVE-2026-68285-b4c3@gregkh>
From: Greg Kroah-Hartman <[email protected]>

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

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

LoongArch: BPF: Fix memory leak in bpf_jit_free()

When bpf_int_jit_compile() is called for subprograms, it returns early
during the first pass (!prog->is_func || extra_pass is false), keeping
ctx->offset alive for the subsequent extra pass.

If JIT compilation fails for a later subprogram, the BPF core aborts and
calls bpf_jit_free() to clean up the first subprogram. However,
bpf_jit_free() fails to free jit_data->ctx.offset, which causes a memory
leak of the JIT context offsets array.

So fix this by adding the missing kvfree(jit_data->ctx.offset) in
bpf_jit_free().

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


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

	Issue introduced in 7.0 with commit 4ab17e762b34c847478f694932c4cd4b1ac2c343 and fixed in 7.1.6 with commit f1557e0a64736b63aed24e285108a7bc3b7de294
	Issue introduced in 7.0 with commit 4ab17e762b34c847478f694932c4cd4b1ac2c343 and fixed in 7.2-rc5 with commit 47e20d4b3da97ef3881d1e55e43545c22424f3fc

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-68285
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/net/bpf_jit.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/f1557e0a64736b63aed24e285108a7bc3b7de294
	https://git.kernel.org/stable/c/47e20d4b3da97ef3881d1e55e43545c22424f3fc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.