RDMA/uverbs: Drop restrack ref on ib_init_ucontext() failure in GET_CONTEXT
- State
- Published
- Severity
- Not Scored
- Published
- Nov 30, 2026
- Updated
- Nov 30, 2026
- Reserved
- Nov 30, 2026
Description
In the Linux kernel, the following vulnerability has been resolved:
RDMA/uverbs: Drop restrack ref on ib_init_ucontext() failure in GET_CONTEXT
The UVERBS_METHOD_GET_CONTEXT handler allocates the ucontext via ib_alloc_ucontext(), which calls rdma_restrack_new() (initialising the kref to 1) and rdma_restrack_set_name(NULL), the latter attaching the current task and taking a task_struct reference. When ib_init_ucontext() subsequently fails, the error path only does:
kfree(attrs->context); attrs->context = NULL;
without first calling rdma_restrack_put() on &attrs->context->res. The kref therefore never reaches zero, restrack_release() is never invoked, and put_task_struct() is never called, so the task_struct reference taken during set_name is leaked permanently.
A local user with access to an RDMA device can repeat this path (e.g. by hitting an RDMA cgroup limit or supplying invalid ucaps) and leak one task_struct reference per attempt, eventually preventing those processes from being reaped or exhausting memory.
The legacy ib_uverbs_get_context() path already handles this correctly at its err_ucontext label, where rdma_restrack_put() precedes kfree(). Mirror that ordering here.
| Product | Versions |
|---|---|
| Linux Linux | a1123418ba1078037d9fecb72573ff7222dfe201 to before e845dc5fa35d90c28861c6a21063f7c73360af75 Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before 7f0bac5c52cb3a31a674ca61c25cd0be2151a05d Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before c50f84dd10f2b6a0d8fa203b08a48d4bb333a07f Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before 7b0cbff7c7e12586dbd55a8ac6a1133da0b7979d Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before d1946ab6dbc31ac4fd87123c337fbabe4da539ef Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before e47ea092ab3cc9f0074f141f749165c86de42171 Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before 02e31eea7c929384b5efe2e80fa22fb42601724a Affecteda1123418ba1078037d9fecb72573ff7222dfe201 to before 9dcacdc41083cccff74292851bf9fde999e0731a Affected |
| Linux Linux | 5.6 Affectedbefore 5.6 Not Affected5.10.275 through 5.10.* Not Affected5.15.226 through 5.15.* Not Affected6.1.193 through 6.1.* Not Affected6.6.163 through 6.6.* Not Affected6.12.119 through 6.12.* Not Affected6.18.65 through 6.18.* Not Affected7.3.6 through 7.3.* Not Affected7.4-rc1 and later Not Affected |
The record has no CVSS score.
Weaknesses
The record names no weakness.
References
- https://git.kernel.org/stable/c/e845dc5fa35d90c28861c6a21063f7c73360af75
- https://git.kernel.org/stable/c/7f0bac5c52cb3a31a674ca61c25cd0be2151a05d
- https://git.kernel.org/stable/c/c50f84dd10f2b6a0d8fa203b08a48d4bb333a07f
- https://git.kernel.org/stable/c/7b0cbff7c7e12586dbd55a8ac6a1133da0b7979d
- https://git.kernel.org/stable/c/d1946ab6dbc31ac4fd87123c337fbabe4da539ef
- https://git.kernel.org/stable/c/e47ea092ab3cc9f0074f141f749165c86de42171
- https://git.kernel.org/stable/c/02e31eea7c929384b5efe2e80fa22fb42601724a
- https://git.kernel.org/stable/c/9dcacdc41083cccff74292851bf9fde999e0731a
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.