Skip to contentSkip to conversation

CVE-2026-97955: net: mana: restore the XDP program pointer when pre-allocation 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:

net: mana: restore the XDP program pointer when pre-allocation fails

mana_xdp_set() publishes the new program into apc->bpf_prog before it allocates anything, because mana_pre_alloc_rxbufs() sizes the buffers from it via mana_get_rxbuf_cfg(). When that allocation fails the function returns the error directly, skipping the err_dealloc_rxbuffs label which is the only place that restores the previous pointer.

The attach is reported as failed, so the BPF core drops the reference it held for the caller and the program can be freed, while apc->bpf_prog still points at it. The next consumer of mana_xdp_get() - typically mana_chn_setxdp() from mana_alloc_queues() on the following ifup, or after a TX timeout reset - then calls bpf_prog_add() on freed memory.

This is reachable from an ordinary "ip link set dev ethX xdp obj ..." whenever the per-queue RX buffer pre-allocation cannot be satisfied.

Restore the previous program on that error path.

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

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

	Issue introduced in 6.18 with commit 730ff06d3f5cc2ce0348414b78c10528b767d4a3 and fixed in 6.18.53 with commit 5b3cdc9abd82b7e49e0f1a21d6eb75466c5ecef8
	Issue introduced in 6.18 with commit 730ff06d3f5cc2ce0348414b78c10528b767d4a3 and fixed in 7.2.7 with commit 9801edfba8dfcdb1da3b0afccdf143e13d646b56
	Issue introduced in 6.18 with commit 730ff06d3f5cc2ce0348414b78c10528b767d4a3 and fixed in 7.3-rc3 with commit 4c46beb807efcc93f5899ebe1f5958248eb296c6

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

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/net/ethernet/microsoft/mana/mana_bpf.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/5b3cdc9abd82b7e49e0f1a21d6eb75466c5ecef8
	https://git.kernel.org/stable/c/9801edfba8dfcdb1da3b0afccdf143e13d646b56
	https://git.kernel.org/stable/c/4c46beb807efcc93f5899ebe1f5958248eb296c6