{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2022-50215",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-06-18T10:57:27.429Z",
        "datePublished": "2025-06-18T11:03:52.197Z",
        "dateUpdated": "2026-05-23T15:23:50.845Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-05-23T15:23:50.845Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nscsi: sg: Allow waiting for commands to complete on removed device\n\nWhen a SCSI device is removed while in active use, currently sg will\nimmediately return -ENODEV on any attempt to wait for active commands that\nwere sent before the removal.  This is problematic for commands that use\nSG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel\nwhen userspace frees or reuses it after getting ENODEV, leading to\ncorrupted userspace memory (in the case of READ-type commands) or corrupted\ndata being sent to the device (in the case of WRITE-type commands).  This\nhas been seen in practice when logging out of a iscsi_tcp session, where\nthe iSCSI driver may still be processing commands after the device has been\nmarked for removal.\n\nChange the policy to allow userspace to wait for active sg commands even\nwhen the device is being removed.  Return -ENODEV only when there are no\nmore responses to read."
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/scsi/sg.c"
                    ],
                    "versions": [
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "bbc118acf7baf9e93c5e1314d14f481301af4d0f",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "f5e61d9b4a699dd16f32d5f39eb1cf98d84c92ed",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "ed9afd967cbfe7da2dc0d5e52c62a778dfe9f16b",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "f135c65085eed869d10e4e7923ce1015288618da",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "408bfa1489a3cfe7150b81ab0b0df99b23dd5411",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "8c004b7dbb340c1e5889f5fb9e5baa6f6e5303e8",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "35e60ec39e862159cb92923eefd5230d4a873cb9",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "03d8241112d5e3cccce1a01274a221099f07d2e1",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "c6517b7942fad663cc1cf3235cbe4207cf769332",
                            "lessThan": "3455607fd7be10b449f5135c00dc306b85dc0d21",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "a0fe972f78eaaf352d593f9ed9079de590ceb286",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "b21c6d2897cd455fa396f4041a0c8165784e949f",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "2.6.28.10",
                            "lessThan": "2.6.29",
                            "status": "affected",
                            "versionType": "semver"
                        },
                        {
                            "version": "2.6.29.2",
                            "lessThan": "2.6.30",
                            "status": "affected",
                            "versionType": "semver"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/scsi/sg.c"
                    ],
                    "versions": [
                        {
                            "version": "2.6.30",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "2.6.30",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "4.9.326",
                            "lessThanOrEqual": "4.9.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "4.14.291",
                            "lessThanOrEqual": "4.14.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "4.19.256",
                            "lessThanOrEqual": "4.19.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.4.211",
                            "lessThanOrEqual": "5.4.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.10.137",
                            "lessThanOrEqual": "5.10.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.15.61",
                            "lessThanOrEqual": "5.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.18.18",
                            "lessThanOrEqual": "5.18.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.19.2",
                            "lessThanOrEqual": "5.19.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.0",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "4.9.326"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "4.14.291"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "4.19.256"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "5.4.211"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "5.10.137"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "5.15.61"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "5.18.18"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "5.19.2"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.30",
                                    "versionEndExcluding": "6.0"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.28.10"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "2.6.29.2"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/bbc118acf7baf9e93c5e1314d14f481301af4d0f"
                },
                {
                    "url": "https://git.kernel.org/stable/c/f5e61d9b4a699dd16f32d5f39eb1cf98d84c92ed"
                },
                {
                    "url": "https://git.kernel.org/stable/c/ed9afd967cbfe7da2dc0d5e52c62a778dfe9f16b"
                },
                {
                    "url": "https://git.kernel.org/stable/c/f135c65085eed869d10e4e7923ce1015288618da"
                },
                {
                    "url": "https://git.kernel.org/stable/c/408bfa1489a3cfe7150b81ab0b0df99b23dd5411"
                },
                {
                    "url": "https://git.kernel.org/stable/c/8c004b7dbb340c1e5889f5fb9e5baa6f6e5303e8"
                },
                {
                    "url": "https://git.kernel.org/stable/c/35e60ec39e862159cb92923eefd5230d4a873cb9"
                },
                {
                    "url": "https://git.kernel.org/stable/c/03d8241112d5e3cccce1a01274a221099f07d2e1"
                },
                {
                    "url": "https://git.kernel.org/stable/c/3455607fd7be10b449f5135c00dc306b85dc0d21"
                }
            ],
            "title": "scsi: sg: Allow waiting for commands to complete on removed device",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}