CVE-2021-47192
scsi: core: sysfs: Fix hang when device state is set via sysfs
Check your servers for CVE-2021-47192
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-47192 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
scsi: core: sysfs: Fix hang when device state is set via sysfs
This fixes a regression added with:
commit f0f82e2476f6 ("scsi: core: Fix capacity set to zero after offlinining device")
The problem is that after iSCSI recovery, iscsid will call into the kernel to set the dev's state to running, and with that patch we now call scsi_rescan_device() with the state_mutex held. If the SCSI error handler thread is just starting to test the device in scsi_send_eh_cmnd() then it's going to try to grab the state_mutex.
We are then stuck, because when scsi_rescan_device() tries to send its I/O scsi_queue_rq() calls -> scsi_host_queue_ready() -> scsi_host_in_recovery() which will return true (the host state is still in recovery) and I/O will just be requeued. scsi_send_eh_cmnd() will then never be able to grab the state_mutex to finish error handling.
To prevent the deadlock move the rescan-related code to after we drop the state_mutex.
This also adds a check for if we are already in the running state. This prevents extra scans and helps the iscsid case where if the transport class has already onlined the device during its recovery process then we don't need userspace to do it again plus possibly block that daemon.
Severity (CVSS)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
- Attack vector
- network: an attacker can reach the vulnerable part over the network, often from the internet
- Attack complexity
- low: an attack works without special conditions
- Privileges required
- none: the attacker does not need an account
- User interaction
- none: nobody has to click or open anything
- Scope
- unchanged: the damage stays inside the vulnerable component
- Impact
- confidentiality low, integrity none, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)
Exploitation
EPSS 0.61%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 50.6% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 10 Apr 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 69aa1a1a569f5c6d554b59352130ef363342ed4c, before edd783162bf2385b43de6764f2d4c6e9f4f6be27 affected from 711459514e297d748f15ba1f5292a3276c3d1dd0, before a792e0128d232251edb5fdf42fb0f9fbb0b44a73 affected from f0f82e2476f6adb9c7a0135cfab8091456990c99, before bcc0e3175a976b7fa9a353960808adb0bb49ead8 affected from f0f82e2476f6adb9c7a0135cfab8091456990c99, before 4edd8cd4e86dd3047e5294bbefcc0a08f66a430f affected c6751ce1a2a415a78e4f5b621628da03196b804c affected from 5.4.143, before 5.4.162 affected from 5.10.61, before 5.10.82 affected from 5.13.13, before 5.14
Other versions: unaffected
|
| Linux |
affected 5.14 unaffected before 5.14 unaffected from 5.4.162 up to and including 5.4.* unaffected from 5.10.82 up to and including 5.10.* unaffected from 5.15.5 up to and including 5.15.* unaffected 5.16 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2021-47192 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2021-47192
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-47192
trivy image --scanners vuln IMAGE | grep CVE-2021-47192
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/edd783162bf2385b43de6764f2d4c6e9f4f6be27 git.kernel.org
- https://git.kernel.org/stable/c/a792e0128d232251edb5fdf42fb0f9fbb0b44a73 git.kernel.org
- https://git.kernel.org/stable/c/bcc0e3175a976b7fa9a353960808adb0bb49ead8 git.kernel.org
- https://git.kernel.org/stable/c/4edd8cd4e86dd3047e5294bbefcc0a08f66a430f git.kernel.org
Source: the record CVE-2021-47192 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse