{"id":"CVE-2025-21882","state":"PUBLISHED","title":"net/mlx5: Fix vport QoS cleanup on error","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/mlx5: Fix vport QoS cleanup on error\n\nWhen enabling vport QoS fails, the scheduling node was never freed,\ncausing a leak.\n\nAdd the missing free and reset the vport scheduling node pointer to\nNULL.","publishedAt":"2025-03-27T14:57:10.906Z","updatedAt":"2026-08-05T11:55:05.817Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"be034baba83e2a80a0b2c0f24c08547b6eedc79a","status":"affected","lessThan":"fead368502bce0e10bea7c0d2895b2fa0c6c10aa","versionType":"git"},{"version":"be034baba83e2a80a0b2c0f24c08547b6eedc79a","status":"affected","lessThan":"7f3528f7d2f98b70e19a6bb7b130fc82c079ac54","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.13","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.13","versionType":"semver"},{"version":"6.13.6","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c"]}],"references":["https://git.kernel.org/stable/c/fead368502bce0e10bea7c0d2895b2fa0c6c10aa","https://git.kernel.org/stable/c/7f3528f7d2f98b70e19a6bb7b130fc82c079ac54"],"weaknesses":[],"ingestedAt":"2026-10-29T20:08:39.238Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/21xxx/CVE-2025-21882.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-21882","state":"PUBLISHED","datePublished":"2025-03-27T14:57:10.906Z","dateUpdated":"2026-08-05T11:55:05.817Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-12-29T08:45:45.782Z"},"containers":{"cna":{"title":"net/mlx5: Fix vport QoS cleanup on error","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet/mlx5: Fix vport QoS cleanup on error\n\nWhen enabling vport QoS fails, the scheduling node was never freed,\ncausing a leak.\n\nAdd the missing free and reset the vport scheduling node pointer to\nNULL."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"be034baba83e2a80a0b2c0f24c08547b6eedc79a","status":"affected","lessThan":"fead368502bce0e10bea7c0d2895b2fa0c6c10aa","versionType":"git"},{"version":"be034baba83e2a80a0b2c0f24c08547b6eedc79a","status":"affected","lessThan":"7f3528f7d2f98b70e19a6bb7b130fc82c079ac54","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.13","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.13","versionType":"semver"},{"version":"6.13.6","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/fead368502bce0e10bea7c0d2895b2fa0c6c10aa"},{"url":"https://git.kernel.org/stable/c/7f3528f7d2f98b70e19a6bb7b130fc82c079ac54"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerable code is reached only through local configuration interfaces — devlink rate netlink, rtnetlink `ip link set ... vf N rate`, or tc matchall/police offload on a VF representor. No remote peer data reaches this path.\nAC:L - The attacker drives the failing branch himself by exhausting the E-Switch scheduling-element pool through repeated rate-object creation across VFs/SFs (and on FW not advertising the VPORT element type in the E-Switch hierarchy it fails deterministically on the first try), then triggers the dangling-pointer use with a follow-up rate operation or VF teardown. No condition lies outside the attacker's influence.\nPR:L - The tc and `ndo_set_vf_rate` paths gate only on `netlink_net_capable(skb, CAP_NET_ADMIN)`, i.e. CAP_NET_ADMIN in the network namespace's owning user namespace, so an unprivileged user inside a userns-owned container netns holding a delegated mlx5 representor/netdev can reach `mlx5_esw_qos_vport_enable()`. This is delegated, non-root-equivalent privilege.\nUI:N - The whole sequence — failed rate set, then subsequent rate operation or VF teardown — is performed by the attacker alone. No victim action is needed.\nS:U - The corruption is confined to mlx5 eswitch QoS objects in kernel heap memory within the same security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The stale `sched_node->parent` makes `esw_qos_normalize_min_rate()` walk `parent->children` out of a freed, attacker-groomable slab object and dereference `node->esw->dev`, yielding a controlled-read primitive over kernel memory rather than a bounded leak.\nI:H - The freed parent is written through `list_del_init(&vport_node->entry)` and via `node->max_rate`/`node->bw_share` stores reached through pointers read from freed memory, giving a UAF write primitive; the `esw_qos_put()` refcount imbalance additionally frees a live node0 out from under other vports, and the stale `ix == 0` causes FW MODIFY/DESTROY on unrelated scheduling elements.\nA:H - VF teardown unconditionally walks the dangling node, producing list-debug corruption, `refcount_t` underflow WARNs and oops/panic from the use-after-free; destroying scheduling element 0 can additionally tear down the E-Switch root TSAR and disrupt traffic for every port on the adapter."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:55:05.817Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.13","versionEndExcluding":"6.13.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.13","versionEndExcluding":"6.14"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}