CVE-2025-21951

In the Linux kernel, the following vulnerability has been resolved: bus: mhi: host: pci_generic: Use pci_try_reset_function() to avoid deadlock There are multiple places from where the recovery work gets scheduled asynchronously. Also, there are multiple places where the caller waits synchronously for the recovery to be completed. One such place is during the PM shutdown() callback. If the device is not alive during recovery_work, it will try to reset the device using pci_reset_function(). This function internally will take the device_lock() first before resetting the device. By this time, if the lock has already been acquired, then recovery_work will get stalled while waiting for the lock. And if the lock was already acquired by the caller which waits for the recovery_work to be completed, it will lead to deadlock. This is what happened on the X1E80100 CRD device when the device died before shutdown() callback. Driver core calls the driver's shutdown() callback while holding the device_lock() leading to deadlock. And this deadlock scenario can occur on other paths as well, like during the PM suspend() callback, where the driver core would hold the device_lock() before calling driver's suspend() callback. And if the recovery_work was already started, it could lead to deadlock. This is also observed on the X1E80100 CRD. So to fix both issues, use pci_try_reset_function() in recovery_work. This function first checks for the availability of the device_lock() before trying to reset the device. If the lock is available, it will acquire it and reset the device. Otherwise, it will return -EAGAIN. If that happens, recovery_work will fail with the error message "Recovery failed" as not much could be done.
Configurations

Configuration 1 (hide)

OR cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc5:*:*:*:*:*:*

History

11 Apr 2025, 13:10

Type Values Removed Values Added
CWE CWE-667
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 5.5
Summary
  • (es) En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: bus: mhi: host: pci_generic: Use pci_try_reset_function() para evitar el interbloqueo Hay varios lugares desde donde el trabajo de recuperación se programa de forma asíncrona. Además, hay varios lugares donde el llamador espera de forma síncrona a que se complete la recuperación. Uno de esos lugares es durante la devolución de llamada de PM shutdown(). Si el dispositivo no está activo durante recovery_work, intentará reiniciar el dispositivo utilizando pci_reset_function(). Esta función tomará internamente primero device_lock() antes de reiniciar el dispositivo. En este momento, si el bloqueo ya se ha adquirido, entonces recovery_work se detendrá mientras espera el bloqueo. Y si el bloqueo ya fue adquirido por el llamador que espera a que se complete recovery_work, provocará un interbloqueo. Esto es lo que ocurrió en el dispositivo X1E80100 CRD cuando el dispositivo murió antes de la devolución de llamada de shutdown(). El núcleo del controlador llama a la devolución de llamada de apagado () del controlador mientras mantiene el device_lock(), lo que provoca un interbloqueo. Este bloqueo también puede ocurrir en otras rutas, como durante la devolución de llamada suspend() de PM, donde el núcleo del controlador mantendría el bloqueo_de_dispositivo() antes de llamar a la devolución de llamada suspend() del controlador. Si el trabajo de recuperación ya se había iniciado, podría provocar un bloqueo. Esto también se observa en el CRD X1E80100. Para solucionar ambos problemas, utilice pci_try_reset_function() en el trabajo de recuperación. Esta función primero comprueba la disponibilidad del bloqueo_de_dispositivo() antes de intentar reiniciar el dispositivo. Si el bloqueo está disponible, lo adquirirá y reiniciará el dispositivo. De lo contrario, devolverá -EAGAIN. En este caso, el trabajo de recuperación fallará con el mensaje de error "Error de recuperación", ya que no se pudo hacer mucho.
CPE cpe:2.3:o:linux:linux_kernel:6.14:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.14:rc5:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
First Time Linux linux Kernel
Linux
References () https://git.kernel.org/stable/c/1f9eb7078bc6b5fb5cbfbcb37c4bc01685332b95 - () https://git.kernel.org/stable/c/1f9eb7078bc6b5fb5cbfbcb37c4bc01685332b95 - Patch
References () https://git.kernel.org/stable/c/62505657475c245c9cd46e42ac01026d1e61f027 - () https://git.kernel.org/stable/c/62505657475c245c9cd46e42ac01026d1e61f027 - Patch
References () https://git.kernel.org/stable/c/7746f3bb8917fccb4571a576f3837d80fc513054 - () https://git.kernel.org/stable/c/7746f3bb8917fccb4571a576f3837d80fc513054 - Patch
References () https://git.kernel.org/stable/c/7a5ffadd54fe2662f5c99cdccf30144d060376f7 - () https://git.kernel.org/stable/c/7a5ffadd54fe2662f5c99cdccf30144d060376f7 - Patch
References () https://git.kernel.org/stable/c/985d3cf56d8745ca637deee273929e01df449f85 - () https://git.kernel.org/stable/c/985d3cf56d8745ca637deee273929e01df449f85 - Patch
References () https://git.kernel.org/stable/c/a321d163de3d8aa38a6449ab2becf4b1581aed96 - () https://git.kernel.org/stable/c/a321d163de3d8aa38a6449ab2becf4b1581aed96 - Patch

01 Apr 2025, 16:15

Type Values Removed Values Added
New CVE

Information

Published : 2025-04-01 16:15

Updated : 2025-04-11 13:10


NVD link : CVE-2025-21951

Mitre link : CVE-2025-21951

CVE.ORG link : CVE-2025-21951


JSON object : View

Products Affected

linux

  • linux_kernel
CWE
CWE-667

Improper Locking