CVE-2025-21800: net/mlx5: HWS, fix definer's HWS_SET32 macro for negative offset
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
net/mlx5: HWS, fix definer's HWS_SET32 macro for negative offset
When bit offset for HWS_SET32 macro is negative,
UBSAN complains about the shift-out-of-bounds:
UBSAN: shift-out-of-bounds in drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c:177:2 shift exponent -8 is negative
The Linux kernel CVE team has assigned CVE-2025-21800 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.12 with commit 74a778b4a63faef9ff02aad0d332b209835f93e1 and fixed in 6.12.13 with commit 92cff996624c4757d5bbace3dfa3f1567ba94143 Issue introduced in 6.12 with commit 74a778b4a63faef9ff02aad0d332b209835f93e1 and fixed in 6.13.2 with commit 69c676c0ded472713e6d1b3a456b3c4f52f66f0e Issue introduced in 6.12 with commit 74a778b4a63faef9ff02aad0d332b209835f93e1 and fixed in 6.14-rc1 with commit be482f1d10da781db9445d2753c1e3f1fd82babf
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-2025-21800
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/steering/hws/definer.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/92cff996624c4757d5bbace3dfa3f1567ba94143 https://git.kernel.org/stable/c/69c676c0ded472713e6d1b3a456b3c4f52f66f0e https://git.kernel.org/stable/c/be482f1d10da781db9445d2753c1e3f1fd82babf