rxrpc: Fix recvmsg() unconditional requeue
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 540b1c48c37ac0ad66212004db21e1ff7e2d78be · < 930114425065f7ace6e0c0630fab4af75e059ea8| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
rxrpc: Fix recvmsg() unconditional requeue
If rxrpc_recvmsg() fails because MSG_DONTWAIT was specified but the call at the front of the recvmsg queue already has its mutex locked, it requeues the call - whether or not the call is already queued. The call may be on the queue because MSG_PEEK was also passed and so the call was not dequeued or because the I/O thread requeued it.
The unconditional requeue may then corrupt the recvmsg queue, leading to things like UAFs or refcount underruns.
Fix this by only requeuing the call if it isn't already on the queue - and moving it to the front if it is already queued. If we don't queue it, we have to put the ref we obtained by dequeuing it.
Also, MSG_PEEK doesn't dequeue the call so shouldn't call rxrpc_notify_socket() for the call if we didn't use up all the data on the queue, so fix that also.
From the CVE record · Linux
The Linux kernel’s rxrpc recvmsg() path can requeue a call that is already queued, corrupting the receive queue and potentially causing use-after-free or reference-count underruns. This can occur when MSG_DONTWAIT is used while the front call’s mutex is locked and the call remains queued, for example after MSG_PEEK or an I/O-thread requeue. The input does not specify attacker access requirements.
Engineers running Linux kernels with rxrpc should check their versions against the vendor advisory; affected versions are not specified here.