CVE-2022-49219 (GCVE-0-2022-49219)
Vulnerability from cvelistv5
Published
2025-02-26 01:55
Modified
2025-05-04 08:32
Severity ?
Summary
In the Linux kernel, the following vulnerability has been resolved: vfio/pci: fix memory leak during D3hot to D0 transition If 'vfio_pci_core_device::needs_pm_restore' is set (PCI device does not have No_Soft_Reset bit set in its PMCSR config register), then the current PCI state will be saved locally in 'vfio_pci_core_device::pm_save' during D0->D3hot transition and same will be restored back during D3hot->D0 transition. For saving the PCI state locally, pci_store_saved_state() is being used and the pci_load_and_free_saved_state() will free the allocated memory. But for reset related IOCTLs, vfio driver calls PCI reset-related API's which will internally change the PCI power state back to D0. So, when the guest resumes, then it will get the current state as D0 and it will skip the call to vfio_pci_set_power_state() for changing the power state to D0 explicitly. In this case, the memory pointed by 'pm_save' will never be freed. In a malicious sequence, the state changing to D3hot followed by VFIO_DEVICE_RESET/VFIO_DEVICE_PCI_HOT_RESET can be run in a loop and it can cause an OOM situation. This patch frees the earlier allocated memory first before overwriting 'pm_save' to prevent the mentioned memory leak.
Impacted products
Vendor Product Version
Linux Linux Version: 51ef3a004b1eb6241e56b3aa8495769a092a4dc2
Version: 51ef3a004b1eb6241e56b3aa8495769a092a4dc2
Version: 51ef3a004b1eb6241e56b3aa8495769a092a4dc2
Version: 51ef3a004b1eb6241e56b3aa8495769a092a4dc2
Version: 51ef3a004b1eb6241e56b3aa8495769a092a4dc2
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "drivers/vfio/pci/vfio_pci_core.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "da426ad86027b849b877d4628b277ffbbd2f5325",
              "status": "affected",
              "version": "51ef3a004b1eb6241e56b3aa8495769a092a4dc2",
              "versionType": "git"
            },
            {
              "lessThan": "4319f17fb8264ba39352b611dfa913a4d8c1d1a0",
              "status": "affected",
              "version": "51ef3a004b1eb6241e56b3aa8495769a092a4dc2",
              "versionType": "git"
            },
            {
              "lessThan": "26ddd196e9eb264da8e1bdc4df8a94d62581c8b5",
              "status": "affected",
              "version": "51ef3a004b1eb6241e56b3aa8495769a092a4dc2",
              "versionType": "git"
            },
            {
              "lessThan": "c8a1f8bd586ee31020614b8d48b702ece3e2ae44",
              "status": "affected",
              "version": "51ef3a004b1eb6241e56b3aa8495769a092a4dc2",
              "versionType": "git"
            },
            {
              "lessThan": "eadf88ecf6ac7d6a9f47a76c6055d9a1987a8991",
              "status": "affected",
              "version": "51ef3a004b1eb6241e56b3aa8495769a092a4dc2",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "drivers/vfio/pci/vfio_pci_core.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "5.1"
            },
            {
              "lessThan": "5.1",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.10.*",
              "status": "unaffected",
              "version": "5.10.237",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.15.*",
              "status": "unaffected",
              "version": "5.15.33",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.16.*",
              "status": "unaffected",
              "version": "5.16.19",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "5.17.*",
              "status": "unaffected",
              "version": "5.17.2",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "5.18",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.10.237",
                  "versionStartIncluding": "5.1",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.15.33",
                  "versionStartIncluding": "5.1",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.16.19",
                  "versionStartIncluding": "5.1",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.17.2",
                  "versionStartIncluding": "5.1",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "5.18",
                  "versionStartIncluding": "5.1",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nvfio/pci: fix memory leak during D3hot to D0 transition\n\nIf \u0027vfio_pci_core_device::needs_pm_restore\u0027 is set (PCI device does\nnot have No_Soft_Reset bit set in its PMCSR config register), then\nthe current PCI state will be saved locally in\n\u0027vfio_pci_core_device::pm_save\u0027 during D0-\u003eD3hot transition and same\nwill be restored back during D3hot-\u003eD0 transition.\nFor saving the PCI state locally, pci_store_saved_state() is being\nused and the pci_load_and_free_saved_state() will free the allocated\nmemory.\n\nBut for reset related IOCTLs, vfio driver calls PCI reset-related\nAPI\u0027s which will internally change the PCI power state back to D0. So,\nwhen the guest resumes, then it will get the current state as D0 and it\nwill skip the call to vfio_pci_set_power_state() for changing the\npower state to D0 explicitly. In this case, the memory pointed by\n\u0027pm_save\u0027 will never be freed. In a malicious sequence, the state changing\nto D3hot followed by VFIO_DEVICE_RESET/VFIO_DEVICE_PCI_HOT_RESET can be\nrun in a loop and it can cause an OOM situation.\n\nThis patch frees the earlier allocated memory first before overwriting\n\u0027pm_save\u0027 to prevent the mentioned memory leak."
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2025-05-04T08:32:37.106Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "references": [
        {
          "url": "https://git.kernel.org/stable/c/da426ad86027b849b877d4628b277ffbbd2f5325"
        },
        {
          "url": "https://git.kernel.org/stable/c/4319f17fb8264ba39352b611dfa913a4d8c1d1a0"
        },
        {
          "url": "https://git.kernel.org/stable/c/26ddd196e9eb264da8e1bdc4df8a94d62581c8b5"
        },
        {
          "url": "https://git.kernel.org/stable/c/c8a1f8bd586ee31020614b8d48b702ece3e2ae44"
        },
        {
          "url": "https://git.kernel.org/stable/c/eadf88ecf6ac7d6a9f47a76c6055d9a1987a8991"
        }
      ],
      "title": "vfio/pci: fix memory leak during D3hot to D0 transition",
      "x_generator": {
        "engine": "bippy-1.2.0"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2022-49219",
    "datePublished": "2025-02-26T01:55:52.131Z",
    "dateReserved": "2025-02-26T01:49:39.292Z",
    "dateUpdated": "2025-05-04T08:32:37.106Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.1",
  "vulnerability-lookup:meta": {
    "nvd": "{\"cve\":{\"id\":\"CVE-2022-49219\",\"sourceIdentifier\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"published\":\"2025-02-26T07:00:58.977\",\"lastModified\":\"2025-05-02T07:15:49.570\",\"vulnStatus\":\"Modified\",\"cveTags\":[],\"descriptions\":[{\"lang\":\"en\",\"value\":\"In the Linux kernel, the following vulnerability has been resolved:\\n\\nvfio/pci: fix memory leak during D3hot to D0 transition\\n\\nIf \u0027vfio_pci_core_device::needs_pm_restore\u0027 is set (PCI device does\\nnot have No_Soft_Reset bit set in its PMCSR config register), then\\nthe current PCI state will be saved locally in\\n\u0027vfio_pci_core_device::pm_save\u0027 during D0-\u003eD3hot transition and same\\nwill be restored back during D3hot-\u003eD0 transition.\\nFor saving the PCI state locally, pci_store_saved_state() is being\\nused and the pci_load_and_free_saved_state() will free the allocated\\nmemory.\\n\\nBut for reset related IOCTLs, vfio driver calls PCI reset-related\\nAPI\u0027s which will internally change the PCI power state back to D0. So,\\nwhen the guest resumes, then it will get the current state as D0 and it\\nwill skip the call to vfio_pci_set_power_state() for changing the\\npower state to D0 explicitly. In this case, the memory pointed by\\n\u0027pm_save\u0027 will never be freed. In a malicious sequence, the state changing\\nto D3hot followed by VFIO_DEVICE_RESET/VFIO_DEVICE_PCI_HOT_RESET can be\\nrun in a loop and it can cause an OOM situation.\\n\\nThis patch frees the earlier allocated memory first before overwriting\\n\u0027pm_save\u0027 to prevent the mentioned memory leak.\"},{\"lang\":\"es\",\"value\":\"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: vfio/pci: se corrige la p\u00e9rdida de memoria durante la transici\u00f3n de D3hot a D0 Si se establece \u0027vfio_pci_core_device::needs_pm_restore\u0027 (el dispositivo PCI no tiene el bit No_Soft_Reset establecido en su registro de configuraci\u00f3n PMCSR), entonces el estado PCI actual se guardar\u00e1 localmente en \u0027vfio_pci_core_device::pm_save\u0027 durante la transici\u00f3n de D0 a D3hot y el mismo se restaurar\u00e1 durante la transici\u00f3n de D3hot a D0. Para guardar el estado PCI localmente, se utiliza pci_store_saved_state() y pci_load_and_free_saved_state() liberar\u00e1 la memoria asignada. Pero para los IOCTL relacionados con el reinicio, el controlador vfio llama a las API relacionadas con el reinicio de PCI que cambiar\u00e1n internamente el estado de energ\u00eda de PCI a D0. Por lo tanto, cuando el invitado se reanude, obtendr\u00e1 el estado actual como D0 y omitir\u00e1 la llamada a vfio_pci_set_power_state() para cambiar el estado de energ\u00eda a D0 expl\u00edcitamente. En este caso, la memoria apuntada por \u0027pm_save\u0027 nunca se liberar\u00e1. En una secuencia maliciosa, el cambio de estado a D3hot seguido de VFIO_DEVICE_RESET/VFIO_DEVICE_PCI_HOT_RESET se puede ejecutar en un bucle y puede causar una situaci\u00f3n de OOM. Este parche libera primero la memoria asignada anteriormente antes de sobrescribir \u0027pm_save\u0027 para evitar la p\u00e9rdida de memoria mencionada.\"}],\"metrics\":{\"cvssMetricV31\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"cvssData\":{\"version\":\"3.1\",\"vectorString\":\"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H\",\"baseScore\":5.5,\"baseSeverity\":\"MEDIUM\",\"attackVector\":\"LOCAL\",\"attackComplexity\":\"LOW\",\"privilegesRequired\":\"LOW\",\"userInteraction\":\"NONE\",\"scope\":\"UNCHANGED\",\"confidentialityImpact\":\"NONE\",\"integrityImpact\":\"NONE\",\"availabilityImpact\":\"HIGH\"},\"exploitabilityScore\":1.8,\"impactScore\":3.6}]},\"weaknesses\":[{\"source\":\"nvd@nist.gov\",\"type\":\"Primary\",\"description\":[{\"lang\":\"en\",\"value\":\"CWE-401\"}]}],\"configurations\":[{\"nodes\":[{\"operator\":\"OR\",\"negate\":false,\"cpeMatch\":[{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.1\",\"versionEndExcluding\":\"5.15.33\",\"matchCriteriaId\":\"C5B0B00D-6DCA-4714-B384-1EB7C214ABBE\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.16\",\"versionEndExcluding\":\"5.16.19\",\"matchCriteriaId\":\"20C43679-0439-405A-B97F-685BEE50613B\"},{\"vulnerable\":true,\"criteria\":\"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*\",\"versionStartIncluding\":\"5.17\",\"versionEndExcluding\":\"5.17.2\",\"matchCriteriaId\":\"210C679C-CF84-44A3-8939-E629C87E54BF\"}]}]}],\"references\":[{\"url\":\"https://git.kernel.org/stable/c/26ddd196e9eb264da8e1bdc4df8a94d62581c8b5\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/4319f17fb8264ba39352b611dfa913a4d8c1d1a0\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/c8a1f8bd586ee31020614b8d48b702ece3e2ae44\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]},{\"url\":\"https://git.kernel.org/stable/c/da426ad86027b849b877d4628b277ffbbd2f5325\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\"},{\"url\":\"https://git.kernel.org/stable/c/eadf88ecf6ac7d6a9f47a76c6055d9a1987a8991\",\"source\":\"416baaa9-dc9f-4396-8d5f-8c081fb06d67\",\"tags\":[\"Patch\"]}]}}"
  }
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…