CVE-2022-50215: scsi: sg: Allow waiting for commands to complete on removed device
In the Linux kernel, the following vulnerability has been resolved:
scsi: sg: Allow waiting for commands to complete on removed device
When a SCSI device is removed while in active use, currently sg will
immediately return -ENODEV on any attempt to wait for active commands that
were sent before the removal. This is problematic for commands that use
SG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel
when userspace frees or reuses it after getting ENODEV, leading to
corrupted userspace memory (in the case of READ-type commands) or corrupted
data being sent to the device (in the case of WRITE-type commands). This
has been seen in practice when logging out of a iscsi_tcp session, where
the iSCSI driver may still be processing commands after the device has been
marked for removal.
Change the policy to allow userspace to wait for active sg commands even
when the device is being removed. Return -ENODEV only when there are no
more responses to read.
Security readout for executives and security teams
Plain-English summary
CVE-2022-50215 is a Linux kernel SCSI generic driver issue. If a SCSI device is removed while commands are still active, userspace can be told the device is gone while the kernel still uses the buffer, risking userspace memory corruption or incorrect data sent to storage.
Executive priority
Treat as a focused storage integrity risk. Prioritize patching storage-heavy Linux hosts, iSCSI environments, and systems where corrupted buffers or writes could affect business-critical data.
Technical view
The sg driver previously returned ENODEV immediately when waiting on pre-removal commands. For SG_FLAG_DIRECT_IO commands, buffers could still be in kernel use after userspace freed or reused them. The fix allows waiting for active sg commands during removal and returns ENODEV only after no responses remain.
Likely exposure
Exposure is most likely on Linux systems using SCSI generic devices with direct I/O during device removal. The source specifically notes this was seen during iscsi_tcp logout. Affected version data is kernel-level and may vary by distribution backports.
Exploitation context
The provided sources do not show active exploitation, public exploit availability, or KEV listing. The issue appears reliability- and integrity-impacting in a specific storage I/O race condition rather than a broadly exposed remote attack path.
Researcher notes
Evidence is limited to the CVE record and kernel stable references. No CVSS, CWE, exploit status, or distribution-specific package matrix is provided. The root condition is a device-removal race around sg command completion and SG_FLAG_DIRECT_IO buffer lifetime.
Mitigation direction
Apply kernel updates from the relevant Linux distribution or vendor.
Confirm the vendor kernel includes the referenced stable sg fix.
Prioritize systems using SCSI generic, direct I/O, or iSCSI workflows.
Check vendor guidance if no package fix is available.
Avoid disruptive SCSI or iSCSI removals until patched where operationally feasible.
Validation and detection
Inventory Linux kernel versions across systems with SCSI or iSCSI usage.
Check distribution advisories for CVE-2022-50215 remediation status.
Verify whether workloads use sg devices with direct I/O.
Review storage logout or device-removal incidents for related corruption symptoms.
Confirm patched kernels include one of the referenced stable commits.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2022-50215 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
0ADP providers
10Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Jun 18, 2025, 11:03 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.