CVE-2022-50202

Source
https://cve.org/CVERecord?id=CVE-2022-50202
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50202.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2022-50202
Downstream
Related
Published
2025-06-18T11:03:43.874Z
Modified
2026-03-20T11:47:18.181350Z
Summary
PM: hibernate: defer device probing when resuming from hibernation
Details

In the Linux kernel, the following vulnerability has been resolved:

PM: hibernate: defer device probing when resuming from hibernation

syzbot is reporting hung task at miscopen() [1], for there is a race window of AB-BA deadlock which involves probecount variable. Currently waitfordeviceprobe() from snapshotopen() from miscopen() can sleep forever with miscmtx held if probe_count cannot become 0.

When a device is probed by hubevent() work function, probecount is incremented before the probe function starts, and probe_count is decremented after the probe function completed.

There are three cases that can prevent probe_count from dropping to 0.

(a) A device being probed stopped responding (i.e. broken/malicious hardware).

(b) A process emulating a USB device using /dev/raw-gadget interface stopped responding for some reason.

(c) New device probe requests keeps coming in before existing device probe requests complete.

The phenomenon syzbot is reporting is (b). A process which is holding systemtransitionmutex and miscmtx is waiting for probecount to become 0 inside waitfordeviceprobe(), but the probe function which is called from hubevent() work function is waiting for the processes which are blocked at mutexlock(&miscmtx) to respond via /dev/raw-gadget interface.

This patch mitigates (b) by deferring waitfordeviceprobe() from snapshotopen() to snapshotwrite() and snapshotioctl(). Please note that the possibility of (b) remains as long as any thread which is emulating a USB device via /dev/raw-gadget interface can be blocked by uninterruptible blocking operations (e.g. mutex_lock()).

Please also note that (a) and (c) are not addressed. Regarding (c), we should change the code to wait for only one device which contains the image for resuming from hibernation. I don't know how to address (a), for use of timeout for waitfordevice_probe() might result in loss of user data in the image. Maybe we should require the userland to wait for the image device before opening /dev/snapshot interface.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50202.json"
}
References

Affected packages

Git / 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
c751085943362143f84346d274e0011419c84202
Fixed
8c90947e5f1801e6c7120021c6ea0f3ad6a4eb91
Fixed
5a283b59bce72c05c60e9f0fa92a28b5b850d8bb
Fixed
3c48d3067eaf878642276f053575a5c642600a50
Fixed
003a456ae6f70bb97e436e02fc5105be577c1570
Fixed
2f0e18e0db42f4f8bc87d3d98333680065ceeff8
Fixed
b8e1ae9433d7bd95f2dcc044a7a6f20a4c40d258
Fixed
f7042cf9dd40733f387b7cac021e626c74b8856f
Fixed
8386c414e27caba8501119948e9551e52b527f59

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2022-50202.json"