{"id":"CVE-2024-40925","summary":"block: fix request.queuelist usage in flush","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nblock: fix request.queuelist usage in flush\n\nFriedrich Weber reported a kernel crash problem and bisected to commit\n81ada09cc25e (\"blk-flush: reuse rq queuelist in flush state machine\").\n\nThe root cause is that we use \"list_move_tail(&rq-\u003equeuelist, pending)\"\nin the PREFLUSH/POSTFLUSH sequences. But rq-\u003equeuelist.next == xxx since\nit's popped out from plug-\u003ecached_rq in __blk_mq_alloc_requests_batch().\nWe don't initialize its queuelist just for this first request, although\nthe queuelist of all later popped requests will be initialized.\n\nFix it by changing to use \"list_add_tail(&rq-\u003equeuelist, pending)\" so\nrq-\u003equeuelist doesn't need to be initialized. It should be ok since rq\ncan't be on any list when PREFLUSH or POSTFLUSH, has no move actually.\n\nPlease note the commit 81ada09cc25e (\"blk-flush: reuse rq queuelist in\nflush state machine\") also has another requirement that no drivers would\ntouch rq-\u003equeuelist after blk_mq_end_request() since we will reuse it to\nadd rq to the post-flush pending list in POSTFLUSH. If this is not true,\nwe will have to revert that commit IMHO.\n\nThis updated version adds \"list_del_init(&rq-\u003equeuelist)\" in flush rq\ncallback since the dm layer may submit request of a weird invalid format\n(REQ_FSEQ_PREFLUSH | REQ_FSEQ_POSTFLUSH), which causes double list_add\nif without this \"list_del_init(&rq-\u003equeuelist)\". The weird invalid format\nproblem should be fixed in dm layer.","modified":"2026-04-02T12:17:19.588284Z","published":"2024-07-12T12:25:05.747Z","related":["SUSE-SU-2024:2802-1","SUSE-SU-2024:2896-1","SUSE-SU-2024:2973-1","SUSE-SU-2025:20008-1","SUSE-SU-2025:20028-1"],"database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/40xxx/CVE-2024-40925.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/87907bd69721a8506618a954d41a1de3040e88aa"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d0321c812d89c5910d8da8e4b10c891c6b96ff70"},{"type":"WEB","url":"https://git.kernel.org/stable/c/fe1e395563ccb051e9dbd8fa99859f5caaad2e71"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/40xxx/CVE-2024-40925.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-40925"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"81ada09cc25e4bf2de7d2951925fb409338a545d"},{"fixed":"fe1e395563ccb051e9dbd8fa99859f5caaad2e71"},{"fixed":"87907bd69721a8506618a954d41a1de3040e88aa"},{"fixed":"d0321c812d89c5910d8da8e4b10c891c6b96ff70"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-40925.json"}}],"schema_version":"1.7.5"}