{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38582","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2025-04-16T04:51:24.026Z","datePublished":"2025-08-19T17:03:04.535Z","dateUpdated":"2026-08-05T12:03:09.343Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T12:03:09.343Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nRDMA/hns: Fix double destruction of rsv_qp\n\nrsv_qp may be double destroyed in error flow, first in free_mr_init(),\nand then in hns_roce_exit(). Fix it by moving the free_mr_init() call\ninto hns_roce_v2_init().\n\nlist_del corruption, ffff589732eb9b50->next is LIST_POISON1 (dead000000000100)\nWARNING: CPU: 8 PID: 1047115 at lib/list_debug.c:53 __list_del_entry_valid+0x148/0x240\n...\nCall trace:\n __list_del_entry_valid+0x148/0x240\n hns_roce_qp_remove+0x4c/0x3f0 [hns_roce_hw_v2]\n hns_roce_v2_destroy_qp_common+0x1dc/0x5f4 [hns_roce_hw_v2]\n hns_roce_v2_destroy_qp+0x22c/0x46c [hns_roce_hw_v2]\n free_mr_exit+0x6c/0x120 [hns_roce_hw_v2]\n hns_roce_v2_exit+0x170/0x200 [hns_roce_hw_v2]\n hns_roce_exit+0x118/0x350 [hns_roce_hw_v2]\n __hns_roce_hw_v2_init_instance+0x1c8/0x304 [hns_roce_hw_v2]\n hns_roce_hw_v2_reset_notify_init+0x170/0x21c [hns_roce_hw_v2]\n hns_roce_hw_v2_reset_notify+0x6c/0x190 [hns_roce_hw_v2]\n hclge_notify_roce_client+0x6c/0x160 [hclge]\n hclge_reset_rebuild+0x150/0x5c0 [hclge]\n hclge_reset+0x10c/0x140 [hclge]\n hclge_reset_subtask+0x80/0x104 [hclge]\n hclge_reset_service_task+0x168/0x3ac [hclge]\n hclge_service_task+0x50/0x100 [hclge]\n process_one_work+0x250/0x9a0\n worker_thread+0x324/0x990\n kthread+0x190/0x210\n ret_from_fork+0x10/0x18"}],"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 defect lives in the hns_roce HIP08 device init/re-init path (`__hns_roce_hw_v2_init_instance()` → `free_mr_init()`), reached via driver probe, module load, or the hns3 NIC reset-recovery notifier — never from remote packet data. Reaching or influencing it requires local access to the machine (RDMA uverbs devices, memory/resource pressure, or a locally initiated reset).\nAC:L - The double destruction fires whenever `free_mr_alloc_res()` fails partway through creating the 8 reserved QPs, since the `create_failed_qp` unwind kfree()s `free_mr->rsv_qp[i]` without NULLing the array slot, leaving dangling pointers that `hns_roce_v2_exit()` → `free_mr_exit()` destroys and frees a second time. A local attacker can influence exactly that partial-failure window by driving slab/QP/CQ/PD resource exhaustion so one of the eight allocations fails after earlier ones succeeded, and the init/reset sequence is repeatable, so the required conditions are not beyond the attacker's control.\nPR:L - No authentication beyond ordinary local access is needed to create the precondition — an unprivileged user holding the usual `/dev/infiniband/uverbs*` access in an RDMA deployment can exhaust QP/CQ/PD and memory resources to make the reserved-resource allocation fail mid-loop. The init/reset trigger itself is not gated by any capability check inside the vulnerable code path.\nUI:N - The faulty unwind executes automatically inside the driver's own error path during device initialization or NIC reset recovery. No victim has to open a file, mount anything, or take any other action.\nS:U - The corrupted objects (`struct hns_roce_qp`, its lists and the kernel slab) all belong to the kernel's own security authority. There is no crossing into a hypervisor, IOMMU, or other separate security scope.\nC:H - The second `hns_roce_v2_destroy_qp()` operates entirely on freed memory — it reads `hr_qp->ibqp.send_cq`/`recv_cq` and passes them to `to_hr_cq()`/`__hns_roce_v2_cq_clean()`, and uses `hr_qp->qpn` for `__xa_erase()`. If the reclaimed slab object is groomed by the attacker, those become fully controlled pointers, yielding an arbitrary kernel-memory read primitive.\nI:H - `hns_roce_qp_remove()` performs three `list_del()` unlinks on the freed object, each writing `prev->next = next; next->prev = prev` with pointers taken from reclaimed slab memory — a classic controlled-write primitive — and the object is then kfree()d a second time, corrupting the freelist. That combination is exploitable for control-flow hijack and privilege escalation.\nA:H - The reported failure is an immediate `list_del corruption ... LIST_POISON1` WARNING in `__list_del_entry_valid()` from `hns_roce_qp_remove()`, and the double kfree() corrupts the slab allocator. This reliably produces an oops/panic and leaves the RDMA device unusable."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/infiniband/hw/hns/hns_roce_hw_v2.c","drivers/infiniband/hw/hns/hns_roce_main.c"],"versions":[{"version":"fd8489294dd2beefb70f12ec4f6132aeec61a4d0","lessThan":"dab173bae3303f074f063750a8dead2550d8c782","status":"affected","versionType":"git"},{"version":"fd8489294dd2beefb70f12ec4f6132aeec61a4d0","lessThan":"fc8b0f5b16bab2e032b4cfcd6218d5df3b80b2ea","status":"affected","versionType":"git"},{"version":"fd8489294dd2beefb70f12ec4f6132aeec61a4d0","lessThan":"10b083dbba22be19baa848432b6f25aa68ab2db5","status":"affected","versionType":"git"},{"version":"fd8489294dd2beefb70f12ec4f6132aeec61a4d0","lessThan":"c6957b95ecc5b63c5a4bb4ecc28af326cf8f6dc8","status":"affected","versionType":"git"},{"version":"2ccf1c75d39949d8ea043d04a2e92d7100ea723d","status":"affected","versionType":"git"},{"version":"d2d9c5127122745da6e887f451dd248cfeffca33","status":"affected","versionType":"git"},{"version":"dac2723d8bfa9cf5333f477741e6e5fa1ed34645","status":"affected","versionType":"git"},{"version":"60595923371c2ebe7faf82536c47eb0c967e3425","status":"affected","versionType":"git"},{"version":"6.1.113","lessThan":"6.2","status":"affected","versionType":"semver"},{"version":"6.6.54","lessThan":"6.7","status":"affected","versionType":"semver"},{"version":"6.10.13","lessThan":"6.11","status":"affected","versionType":"semver"},{"version":"6.11.2","lessThan":"6.12","status":"affected","versionType":"semver"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/infiniband/hw/hns/hns_roce_hw_v2.c","drivers/infiniband/hw/hns/hns_roce_main.c"],"versions":[{"version":"6.12","status":"affected"},{"version":"0","lessThan":"6.12","status":"unaffected","versionType":"semver"},{"version":"6.12.42","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.15.10","lessThanOrEqual":"6.15.*","status":"unaffected","versionType":"semver"},{"version":"6.16.1","lessThanOrEqual":"6.16.*","status":"unaffected","versionType":"semver"},{"version":"6.17","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.12.42"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.15.10"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.16.1"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12","versionEndExcluding":"6.17"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.1.113"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.6.54"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10.13"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11.2"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/dab173bae3303f074f063750a8dead2550d8c782"},{"url":"https://git.kernel.org/stable/c/fc8b0f5b16bab2e032b4cfcd6218d5df3b80b2ea"},{"url":"https://git.kernel.org/stable/c/10b083dbba22be19baa848432b6f25aa68ab2db5"},{"url":"https://git.kernel.org/stable/c/c6957b95ecc5b63c5a4bb4ecc28af326cf8f6dc8"}],"title":"RDMA/hns: Fix double destruction of rsv_qp","x_generator":{"engine":"bippy-1.2.0"}}}}