Cyber Posture

CVE-2025-21751

High

Published: 27 February 2025

Published
27 February 2025
Modified
19 September 2025
KEV Added
Patch
CVSS Score 7.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.0007 21.1th percentile
Risk Priority 16 60% EPSS · 20% KEV · 20% CVSS

Description

In the Linux kernel, the following vulnerability has been resolved: net/mlx5: HWS, change error flow on matcher disconnect Currently, when firmware failure occurs during matcher disconnect flow, the error flow of the function reconnects the matcher back and returns an error, which continues running the calling function and eventually frees the matcher that is being disconnected. This leads to a case where we have a freed matcher on the matchers list, which in turn leads to use-after-free and eventual crash. This patch fixes that by not trying to reconnect the matcher back when some FW command fails during disconnect. Note that we're dealing here with FW error. We can't overcome this problem. This might lead to bad steering state (e.g. wrong connection between matchers), and will also lead to resource leakage, as it is the case with any other error handling during resource destruction. However, the goal here is to allow the driver to continue and not crash the machine with use-after-free error.

Security Summary

CVE-2025-21751 is a use-after-free vulnerability (CWE-416) in the Linux kernel's mlx5 network driver, specifically within the Hardware Steering (HWS) component. The issue arises during the matcher disconnect flow when a firmware failure occurs: the existing error handling reconnects the matcher and returns an error, allowing the calling function to proceed and free the matcher while it remains listed, leading to a use-after-free condition and system crash. The vulnerability carries a CVSS v3.1 base score of 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H) and was published on 2025-02-27.

A local attacker with low privileges can exploit this vulnerability due to its low attack complexity and lack of user interaction requirements. Successful exploitation could result in high impacts to confidentiality, integrity, and availability, potentially enabling arbitrary code execution, data corruption, or system crashes via the use-after-free in the mlx5 driver's matcher handling.

The provided patch references from kernel.org stable repositories (commits 1ce840c7a659aa53a31ef49f0271b4fd0dc10296, 23a86c76a1a197e8fbbbd0ce3e826eb58c471624, and 5682aad0276ff9b9b0eff3188eb6a1f504d6b436) mitigate the issue by modifying the error flow in the mlx5 HWS matcher disconnect function. Instead of attempting to reconnect the matcher on firmware command failure, the updated code avoids reconnection, preventing the use-after-free and crash at the cost of potential bad steering state or resource leakage, as firmware errors cannot be fully resolved during resource destruction.

Details

CWE(s)
CWE-416

Affected Products

linux
linux kernel
≤ 6.13.3

References