CVE-2024-40925: block: fix request.queuelist usage in flush
In the Linux kernel, the following vulnerability has been resolved:
block: fix request.queuelist usage in flush
Friedrich Weber reported a kernel crash problem and bisected to commit 81ada09cc25e ("blk-flush: reuse rq queuelist in flush state machine").
The root cause is that we use "listmovetail(&rq->queuelist, pending)" in the PREFLUSH/POSTFLUSH sequences. But rq->queuelist.next == xxx since it's popped out from plug->cachedrq in blkmqallocrequestsbatch(). We don't initialize its queuelist just for this first request, although the queuelist of all later popped requests will be initialized.
Fix it by changing to use "listaddtail(&rq->queuelist, pending)" so rq->queuelist doesn't need to be initialized. It should be ok since rq can't be on any list when PREFLUSH or POSTFLUSH, has no move actually.
Please note the commit 81ada09cc25e ("blk-flush: reuse rq queuelist in flush state machine") also has another requirement that no drivers would touch rq->queuelist after blkmqendrequest() since we will reuse it to add rq to the post-flush pending list in POSTFLUSH. If this is not true, we will have to revert that commit IMHO.
This updated version adds "listdelinit(&rq->queuelist)" in flush rq callback since the dm layer may submit request of a weird invalid format (REQFSEQPREFLUSH | REQFSEQPOSTFLUSH), which causes double listadd if without this "listdelinit(&rq->queuelist)". The weird invalid format problem should be fixed in dm layer.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 6.6.35 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 6.9.6 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 6.10 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.25-1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Patch 81ada09cc25e - Configuration
Apply the kernel change that adds list_del_init(&rq->queuelist) in the flush rq callback, to prevent double list_add caused by the dm layer submitting requests with REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH.
Linux kernel block layer (blk-flush) list_move_tail(&rq->queuelist, pending) -> list_del_init(&rq->queuelist) in flush rq callback = list_del_init(&rq->queuelist)
Event History
Frequently Asked Questions
What is the severity of CVE-2024-40925?
CVE-2024-40925 has a high severity rating due to its potential to cause system crashes.
How do I fix CVE-2024-40925?
To fix CVE-2024-40925, update to the latest kernel version as specified in the affected software details.
What systems are affected by CVE-2024-40925?
CVE-2024-40925 affects specific versions of the Linux kernel, including those from Red Hat and Debian.
Can CVE-2024-40925 result in data loss?
Yes, the crash caused by CVE-2024-40925 may potentially lead to data loss if not resolved promptly.
Is CVE-2024-40925 actively being exploited?
There is no public indication that CVE-2024-40925 is currently being exploited in the wild.