Subject: CVE-2024-46717: net/mlx5e: SHAMPO, Fix incorrect page release

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

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

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

net/mlx5e: SHAMPO, Fix incorrect page release

Under the following conditions:
1) No skb created yet
2) header_size == 0 (no SHAMPO header)
3) header_index + 1 % MLX5E_SHAMPO_WQ_HEADER_PER_PAGE == 0 (this is the
   last page fragment of a SHAMPO header page)

a new skb is formed with a page that is NOT a SHAMPO header page (it
is a regular data page). Further down in the same function
(mlx5e_handle_rx_cqe_mpwrq_shampo()), a SHAMPO header page from
header_index is released. This is wrong and it leads to SHAMPO header
pages being released more than once.

The Linux kernel CVE team has assigned CVE-2024-46717 to this issue.

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

	Fixed in 6.1.109 with commit 03924d117625
	Fixed in 6.6.50 with commit ae9018e3f61b
	Fixed in 6.10.9 with commit c909ab41df2b
	Fixed in 6.11 with commit 70bd03b89f20

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-2024-46717
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/mellanox/mlx5/core/en_rx.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/03924d117625ecb10ee3c9b65930bcb2c37ae629
	https://git.kernel.org/stable/c/ae9018e3f61ba5cc1f08a6e51d3c0bef0a79f3ab
	https://git.kernel.org/stable/c/c909ab41df2b09cde919801c7a7b6bb2cc37ea22
	https://git.kernel.org/stable/c/70bd03b89f20b9bbe51a7f73c4950565a17a45f7