RDMA/ucma: Serialize join and leave on copy_to_user failure
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ fe454dc31e84f8c14cb8942fcb61666c9f40745b · < 01cbdb724c584d7772fd25af2e4dfdf8527ce0d5| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
RDMA/ucma: Serialize join and leave on copy_to_user failure
rdma_join_multicast() queues RoCE work that later reads the ucma_multicast through event->param.ud.private_data, then list_add()s the CMA multicast at the head of id_priv->mc_list. rdma_leave_multicast() matches only by sockaddr and destroys the first hit.
ucma_process_join() used to drop ctx->mutex after a successful join and retake it only if copy_to_user() failed. Two concurrent JOIN_MCAST calls with the same address can therefore insert a second CMA entry before the first thread's leave. leave then cancels the newer work and the older worker still dereferences the ucma_multicast that the first thread frees.
Keep ctx->mutex held from rdma_join_multicast() through copy_to_user() and, on -EFAULT, through rdma_leave_multicast() so leave cannot miss this join. Do not leave if join itself failed: that path never published this address on mc_list, and a leave-by-addr would destroy an earlier successful join.
From the CVE record · Linux
A race in the Linux kernel's RDMA/ucma multicast join handling can cause a worker to access freed memory. It requires concurrent JOIN_MCAST calls for the same address and a copy_to_user() failure; the input does not specify authentication requirements.
Engineers running Linux kernels with RDMA/ucma should check whether their kernel includes the fix; affected versions are not specified.