Subject: CVE-2024-26858: net/mlx5e: Use a memory barrier to enforce PTP WQ xmit submission tracking occurs after populating the metadata_map

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

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

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

net/mlx5e: Use a memory barrier to enforce PTP WQ xmit submission tracking occurs after populating the metadata_map

Just simply reordering the functions mlx5e_ptp_metadata_map_put and
mlx5e_ptpsq_track_metadata in the mlx5e_txwqe_complete context is not good
enough since both the compiler and CPU are free to reorder these two
functions. If reordering does occur, the issue that was supposedly fixed by
7e3f3ba97e6c ("net/mlx5e: Track xmit submission to PTP WQ after populating
metadata map") will be seen. This will lead to NULL pointer dereferences in
mlx5e_ptpsq_mark_ts_cqes_undelivered in the NAPI polling context due to the
tracking list being populated before the metadata map.

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

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

	Issue introduced in 6.6.3 with commit 4d510506b465 and fixed in 6.6.22 with commit d1f71615dbb3
	Issue introduced in 6.7 with commit 7e3f3ba97e6c and fixed in 6.7.10 with commit 936ef086161a
	Issue introduced in 6.7 with commit 7e3f3ba97e6c and fixed in 6.8 with commit b7cf07586c40
	Issue introduced in 6.5.13 with commit a9d6c0c5a6bd

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-26858
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_tx.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/d1f71615dbb305f14f3b756cce015d70d8667549
	https://git.kernel.org/stable/c/936ef086161ab89a7f38f7a0761d6a3063c3277e
	https://git.kernel.org/stable/c/b7cf07586c40f926063d4d09f7de28ff82f62b2a