CVE-2021-47391: RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests

Published May 21, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

RDMA/cma: Ensure rdmaaddrcancel() happens before issuing more requests

The FSM can run in a circle allowing rdmaresolveip() to be called twice on the same idpriv. While this cannot happen without going through the work, it violates the invariant that the same address resolution background request cannot be active twice.

CPU 1 CPU 2

rdmaresolveaddr(): RDMACMIDLE -> RDMACMADDRQUERY rdmaresolveip(addrhandler) #1

processonereq(): for #1 addrhandler(): RDMACMADDRQUERY -> RDMACMADDRBOUND mutexunlock(&idpriv->handlermutex); [.. handler still running ..]

rdmaresolveaddr(): RDMACMADDRBOUND -> RDMACMADDRQUERY rdmaresolveip(addrhandler) !! two requests are now on the reqlist

rdmadestroyid(): destroyidhandlerunlock(): destroyid(): cmacanceloperation(): rdmaaddrcancel()

// processonereq() self removes it spinlockbh(&lock); canceldelayedwork(&req->work); if (!listempty(&req->list)) == true

! rdmaaddrcancel() returns after processonreq #1 is done

kfree(idpriv)

processonereq(): for #2 addrhandler(): mutexlock(&idpriv->handlermutex); !! Use after free on idpriv

rdmaaddrcancel() expects there to be one req on the list and only cancels the first one. The self-removal behavior of the work only happens after the handler has returned. This yields a situations where the reqlist can have two reqs for the same "handle" but rdmaaddrcancel() only cancels the first one.

The second req remains active beyond rdmadestroyid() and will use-after-free idpriv once it inevitably triggers.

Fix this by remembering if the idpriv has called rdmaresolveip() and always cancel before calling it again. This ensures the reqlist never gets more than one item in it and doesn't cost anything in the normal flow that never uses this strange error path.

Affected Software

6 affected components
Linux Foundation Linux Kernel
Linux Linux kernel>=2.6.18<5.10.188
Linux Linux kernel>=5.11<5.14.10
Linux Linux kernel=5.15-rc1
Linux Linux kernel=5.15-rc2
Linux Linux kernel=5.15-rc3

Event History

May 21, 2024
CVE Published
via MITRE·03:03 PM
Data Sourced
via MITRE·03:03 PM
DescriptionSeverity
Data Sourced
via NVD·03:15 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2021-47391?

CVE-2021-47391 has a medium severity rating due to the potential for denial of service conditions.

2

How do I fix CVE-2021-47391?

To fix CVE-2021-47391, update your Linux kernel to the latest version that includes the patch for this vulnerability.

3

What software is affected by CVE-2021-47391?

CVE-2021-47391 affects the Linux kernel, particularly versions that handle RDMA.

4

What are the consequences of CVE-2021-47391?

The consequences of CVE-2021-47391 may include the inability to handle RDMA requests properly, potentially leading to service interruptions.

5

Is CVE-2021-47391 exploitable remotely?

CVE-2021-47391 has the potential to be exploited remotely if the vulnerable software is accessible over a network.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203