CVE-2025-68807
JSON

Not scored

block: fix race between wbt_enable_default and IO submission

Severity
Not scored
Exploit likelihood
0.18% (higher than 8% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Linux

Description

In the Linux kernel, the following vulnerability has been resolved: block: fix race between wbt_enable_default and IO submission When wbt_enable_default() is moved out of queue freezing in elevator_change(), it can cause the wbt inflight counter to become negative (-1), leading to hung tasks in the writeback path. Tasks get stuck in wbt_wait() because the counter is in an inconsistent state. The issue occurs because wbt_enable_default() could race with IO submission, allowing the counter to be decremented before proper initialization. This manifests as: rq_wait[0]: inflight: -1 has_waiters: True rwb_enabled() checks the state, which can be updated exactly between wbt_wait() (rq_qos_throttle()) and wbt_track()(rq_qos_track()), then the inflight counter will become negative. And results in hung task warnings like: task:kworker/u24:39 state:D stack:0 pid:14767 Call Trace: rq_qos_wait+0xb4/0x150 wbt_wait+0xa9/0x100 __rq_qos_throttle+0x24/0x40 blk_mq_submit_bio+0x672/0x7b0 ... Fix this by: 1. Splitting wbt_enable_default() into: - __wbt_enable_default(): Returns true if wbt_init() should be called - wbt_enable_default(): Wrapper for existing callers (no init) - wbt_init_enable_default(): New function that checks and inits WBT 2. Using wbt_init_enable_default() in blk_register_queue() to ensure proper initialization during queue registration 3. Move wbt_init() out of wbt_enable_default() which is only for enabling disabled wbt from bfq and iocost, and wbt_init() isn't needed. Then the original lock warning can be avoided. 4. Removing the ELEVATOR_FLAG_ENABLE_WBT_ON_EXIT flag and its handling code since it's no longer needed This ensures WBT is properly initialized before any IO can be submitted, preventing the counter from going negative.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 78c271344b6f64ce24c845e54903e09928cf2061 before f55201fb3becff6a903fd29f4d1147cc7e91eb0c, from 78c271344b6f64ce24c845e54903e09928cf2061 before 9869d3a6fed381f3b98404e26e1afc75d680cbf9, 6.16
Not affected: before 6.16, from 6.18.3 up to 6.18.*, from 6.19 up to *
CVE List

What each source says

CVE List

In the Linux kernel, the following vulnerability has been resolved: block: fix race between wbt_enable_default and IO submission When wbt_enable_default() is moved out of queue freezing in elevator_change(), it can cause the wbt inflight counter to become negative (-1), leading to hung tasks in the writeback path. Tasks get stuck in wbt_wait() because the counter is in an inconsistent state. The issue occurs because wbt_enable_default() could race with IO submission, allowing the counter to be decremented before proper initialization. This manifests as: rq_wait[0]: inflight: -1 has_waiters: True rwb_enabled() checks the state, which can be updated exactly between wbt_wait() (rq_qos_throttle()) and wbt_track()(rq_qos_track()), then the inflight counter will become negative. And results in hung task warnings like: task:kworker/u24:39 state:D stack:0 pid:14767 Call Trace: rq_qos_wait+0xb4/0x150 wbt_wait+0xa9/0x100 __rq_qos_throttle+0x24/0x40 blk_mq_submit_bio+0x672/0x7b0 ... Fix this by: 1. Splitting wbt_enable_default() into: - __wbt_enable_default(): Returns true if wbt_init() should be called - wbt_enable_default(): Wrapper for existing callers (no init) - wbt_init_enable_default(): New function that checks and inits WBT 2. Using wbt_init_enable_default() in blk_register_queue() to ensure proper initialization during queue registration 3. Move wbt_init() out of wbt_enable_default() which is only for enabling disabled wbt from bfq and iocost, and wbt_init() isn't needed. Then the original lock warning can be avoided. 4. Removing the ELEVATOR_FLAG_ENABLE_WBT_ON_EXIT flag and its handling code since it's no longer needed This ensures WBT is properly initialized before any IO can be submitted, preventing the counter from going negative.

NVD (es)

En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: block: corrige la condición de carrera entre wbt_enable_default y el envío de E/S Cuando wbt_enable_default() se mueve fuera de la congelación de la cola en elevator_change(), puede hacer que el contador inflight de wbt se vuelva negativo (-1), lo que lleva a tareas colgadas en la ruta de writeback. Las tareas se quedan atascadas en wbt_wait() porque el contador está en un estado inconsistente. El problema ocurre porque wbt_enable_default() podría competir con el envío de E/S, permitiendo que el contador se decremente antes de la inicialización adecuada. Esto se manifiesta como: rq_wait[0]: inflight: -1 has_waiters: True rwb_enabled() verifica el estado, que puede actualizarse exactamente entre wbt_wait() (rq_qos_throttle()) y wbt_track()(rq_qos_track()), entonces el contador inflight se volverá negativo. Y resulta en advertencias de tareas colgadas como: task:kworker/u24:39 state:D stack:0 pid:14767 Call Trace: rq_qos_wait+0xb4/0x150 wbt_wait+0xa9/0x100 __rq_qos_throttle+0x24/0x40 blk_mq_submit_bio+0x672/0x7b0 ... Esto se soluciona mediante: 1. Dividiendo wbt_enable_default() en: - __wbt_enable_default(): Devuelve verdadero si se debe llamar a wbt_init() - wbt_enable_default(): Envoltorio para las funciones que ya lo llaman (sin inicialización) - wbt_init_enable_default(): Nueva función que verifica e inicializa WBT 2. Usando wbt_init_enable_default() en blk_register_queue() para asegurar una inicialización adecuada durante el registro de la cola 3. Moviendo wbt_init() fuera de wbt_enable_default(), que es solo para habilitar wbt deshabilitado de bfq e iocost, y wbt_init() no es necesario. Así se puede evitar la advertencia de bloqueo original. 4. Eliminando la bandera ELEVATOR_FLAG_ENABLE_WBT_ON_EXIT y su código de manejo, ya que ya no es necesario Esto asegura que WBT se inicialice correctamente antes de que se pueda enviar cualquier E/S, evitando que el contador se vuelva negativo.

References

Sources

SourceRecordLicence
CVE ListCVE-2025-68807 changed 2026-05-11CVE Terms of Use
NVDCVE-2025-68807 changed 2026-06-17Public domain