CVE-2025-21951 bus: mhi: host: pci_generic: Use pci_try_reset_function() to avoid deadlock

Medium 5.5 Published Updated

A race condition in the Linux kernel MHI host driver can cause a deadlock during device recovery, leading to a denial of service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2025-21951?

CVE-2025-21951 is a medium-severity vulnerability in Linux kernel, published on 1 Apr 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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.

Weakness: CWE-667

Which versions are affected by CVE-2025-21951?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-21951?

Apply the vendor's patch.

Is CVE-2025-21951 being exploited?

There is no known exploitation of CVE-2025-21951 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-59916, AZL-59972, BELL-CVE-2025-21951, DEBIAN-CVE-2025-21951, GHSA-pf4f-8wpm-5vh2, ROOT-OS-UBUNTU-2404-CVE-2025-21951 and 1 more.

Is CVE-2025-21951 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free