← Back to CVE Explorer

CVE-2025-40219

Full vulnerability record from the local CVENow database.

Description

In the Linux kernel, the following vulnerability has been resolved: PCI/IOV: Fix race between SR-IOV enable/disable and hotplug Commit 05703271c3cd ("PCI/IOV: Add PCI rescan-remove locking when enabling/disabling SR-IOV") tried to fix a race between the VF removal inside sriov_del_vfs() and concurrent hot unplug by taking the PCI rescan/remove lock in sriov_del_vfs(). Similarly the PCI rescan/remove lock was also taken in sriov_add_vfs() to protect addition of VFs. This approach however causes deadlock on trying to remove PFs with SR-IOV enabled because PFs disable SR-IOV during removal and this removal happens under the PCI rescan/remove lock. So the original fix had to be reverted. Instead of taking the PCI rescan/remove lock in sriov_add_vfs() and sriov_del_vfs(), fix the race that occurs with SR-IOV enable and disable vs hotplug higher up in the callchain by taking the lock in sriov_numvfs_store() before calling into the driver's sriov_configure() callback.

Severity
Not scored
CVSS score
Not available
Vulnerability status
Deferred
Source identifier
416baaa9-dc9f-4396-8d5f-8c081fb06d67
Published
2025-12-04 15:15:57.790000
Last modified
2026-10-19 21:10:00.160000
View original CVE JSON
{
  "id": "CVE-2025-40219",
  "sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
  "published": "2025-12-04T15:15:57.790",
  "lastModified": "2026-10-19T21:10:00.160",
  "vulnStatus": "Deferred",
  "cveTags": [],
  "descriptions": [
    {
      "lang": "en",
      "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nPCI/IOV: Fix race between SR-IOV enable/disable and hotplug\n\nCommit 05703271c3cd (\"PCI/IOV: Add PCI rescan-remove locking when\nenabling/disabling SR-IOV\") tried to fix a race between the VF removal\ninside sriov_del_vfs() and concurrent hot unplug by taking the PCI\nrescan/remove lock in sriov_del_vfs(). Similarly the PCI rescan/remove lock\nwas also taken in sriov_add_vfs() to protect addition of VFs.\n\nThis approach however causes deadlock on trying to remove PFs with SR-IOV\nenabled because PFs disable SR-IOV during removal and this removal happens\nunder the PCI rescan/remove lock. So the original fix had to be reverted.\n\nInstead of taking the PCI rescan/remove lock in sriov_add_vfs() and\nsriov_del_vfs(), fix the race that occurs with SR-IOV enable and disable vs\nhotplug higher up in the callchain by taking the lock in\nsriov_numvfs_store() before calling into the driver's sriov_configure()\ncallback."
    },
    {
      "lang": "es",
      "value": "En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nPCI/IOV: Añadir bloqueo de reescaneo-eliminación de PCI al habilitar/deshabilitar SR-IOV\n\nAntes de deshabilitar SR-IOV a través de accesos al espacio de configuración del PF padre, 'sriov_disable()' primero elimina los dispositivos PCI que representan las VF.\n\nDesde el commit 9d16947b7583 (“PCI: Añadir bloqueo global pci_lock_rescan_remove()”), dichas operaciones de eliminación se serializan frente a eliminaciones y reescaneos concurrentes utilizando el 'pci_rescan_remove_lock'. Sin embargo, nunca se añadió tal bloqueo en 'sriov_disable()'. En particular, cuando el commit 18f9e9d150fc (“PCI/IOV: Refactorizar sriov_add_vfs()”) refactorizó la eliminación de dispositivos PCI en 'sriov_del_vfs()', todavía no había bloqueo alrededor de las llamadas a 'pci_iov_remove_virtfn()'.\n\nEn s390, la falta de serialización en 'sriov_disable()' puede causar doble eliminación y corrupción de la lista, observándose el siguiente rastro (modificado):\n\n  PSW:  0704c00180000000 0000000c914e4b38 (klist_put+56)\n  GPRS: 000003800313fb48 0000000000000000 0000000100000001 0000000000000001\n\t00000000f9b520a8 0000000000000000 0000000000002fbd 00000000f4cc9480\n\t0000000000000001 0000000000000000 0000000000000000 0000000180692828\n\t00000000818e8000 000003800313fe2c 000003800313fb20 000003800313fad8\n  #0 [3800313fb20] device_del at c9158ad5c\n  #1 [3800313fb88] pci_remove_bus_device at c915105ba\n  #2 [3800313fbd0] pci_iov_remove_virtfn at c9152f198\n  #3 [3800313fc28] zpci_iov_remove_virtfn at c90fb67c0\n  #4 [3800313fc60] zpci_bus_remove_device at c90fb6104\n  #5 [3800313fca0] __zpci_event_availability at c90fb3dca\n  #6 [3800313fd08] chsc_process_sei_nt0 at c918fe4a2\n  #7 [3800313fd60] crw_collect_info at c91905822\n  #8 [3800313fe10] kthread at c90feb390\n  #9 [3800313fe68] __ret_from_fork at c90f6aa64\n  #10 [3800313fe98] ret_from_fork at c9194f3f2.\n\nEsto se debe a que, además de que 'sriov_disable()' elimina las VF, la plataforma también genera eventos de desconexión en caliente para las VF. Siendo esta la operación inversa a los eventos de conexión en caliente generados por 'sriov_enable()' y gestionados a través de 'pdev->no_vf_scan'. Y aunque el procesamiento de eventos toma 'pci_rescan_remove_lock' y comprueba si la estructura 'pci_dev' todavía existe, la falta de sincronización hace que esta comprobación sea propensa a condiciones de carrera.\n\nPor supuesto, también pueden ser posibles otras condiciones de carrera, aunque dado que esta falta de bloqueo persistió durante tanto tiempo, las condiciones de carrera observables parecen muy raras. Incluso en s390, la corrupción de la lista solo se observó con ciertos dispositivos, ya que los eventos de la plataforma solo se activan por accesos de configuración después de la eliminación, por lo que, mientras la eliminación terminara sincrónicamente, no habría condiciones de carrera. De cualquier manera, falta el bloqueo, así que se soluciona añadiéndolo a la función auxiliar 'sriov_del_vfs()'.\n\nAl igual que en el reescaneo-eliminación de PCI, también falta el bloqueo en 'sriov_add_vfs()', incluso para el caso de error en el que se llama a 'pci_stop_and_remove_bus_device()' sin que se mantenga el bloqueo de reescaneo-eliminación de PCI. Incluso en el caso sin error, la adición de nuevos dispositivos y buses PCI debe serializarse a través del bloqueo de reescaneo-eliminación de PCI. Añadir el bloqueo necesario."
    }
  ],
  "affected": [
    {
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
      "affectedData": [
        {
          "vendor": "Linux",
          "product": "Linux",
          "defaultStatus": "unaffected",
          "programFiles": [
            "drivers/pci/iov.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "versions": [
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "3cddde484471c602bea04e6f384819d336a1ff84",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "d7673ac466eca37ec3e6b7cc9ccdb06de3304e9b",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "7c37920c96b85ef4255a7acc795e99e63dd38d59",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "1047ca2d816994f31e1475e63e0c0b7825599747",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "97c18f074ff1c12d016a0753072a3afdfa0b9611",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "bea1d373098b22d7142da48750ce5526096425bc",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "f3015627b6e9ddf85cfeaf42405b3c194dde2c36",
              "versionType": "git",
              "status": "affected"
            },
            {
              "version": "18f9e9d150fccfa747875df6f0a9f606740762b3",
              "lessThan": "a5338e365c4559d7b4d7356116b0eb95b12e08d5",
              "versionType": "git",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Linux",
          "product": "Linux",
          "defaultStatus": "affected",
          "programFiles": [
            "drivers/pci/iov.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "versions": [
            {
              "version": "5.0",
              "status": "affected"
            },
            {
              "version": "0",
              "lessThan": "5.0",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "5.10.252",
              "lessThanOrEqual": "5.10.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "5.15.202",
              "lessThanOrEqual": "5.15.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.1.165",
              "lessThanOrEqual": "6.1.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.6.128",
              "lessThanOrEqual": "6.6.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.12.75",
              "lessThanOrEqual": "6.12.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.18.16",
              "lessThanOrEqual": "6.18.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "6.19.6",
              "lessThanOrEqual": "6.19.*",
              "versionType": "semver",
              "status": "unaffected"
            },
            {
              "version": "7.0",
              "lessThanOrEqual": "*",
              "versionType": "original_commit_for_fix",
              "status": "unaffected"
            }
          ]
        }
      ]
    },
    {
      "source": "0b142b55-0307-4c5a-b3c9-f314f3fb7c5e",
      "affectedData": [
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.6",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.5",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.7",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.6",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.5",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.7",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.6",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.5",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.7",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.6",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.5",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIMATIC S7-1500 CPU 1518F-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.7",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIPLUS S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.6",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIPLUS S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.5",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        },
        {
          "vendor": "Siemens",
          "product": "SIPLUS S7-1500 CPU 1518-4 PN/DP MFP",
          "defaultStatus": "unknown",
          "versions": [
            {
              "version": "V3.1.7",
              "lessThan": "*",
              "versionType": "custom",
              "status": "affected"
            }
          ]
        }
      ]
    }
  ],
  "metrics": {},
  "references": [
    {
      "url": "https://git.kernel.org/stable/c/1047ca2d816994f31e1475e63e0c0b7825599747",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/3cddde484471c602bea04e6f384819d336a1ff84",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/7c37920c96b85ef4255a7acc795e99e63dd38d59",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/97c18f074ff1c12d016a0753072a3afdfa0b9611",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/a5338e365c4559d7b4d7356116b0eb95b12e08d5",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/bea1d373098b22d7142da48750ce5526096425bc",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/d7673ac466eca37ec3e6b7cc9ccdb06de3304e9b",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://git.kernel.org/stable/c/f3015627b6e9ddf85cfeaf42405b3c194dde2c36",
      "source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
    },
    {
      "url": "https://cert-portal.siemens.com/productcert/html/ssa-019113.html",
      "source": "0b142b55-0307-4c5a-b3c9-f314f3fb7c5e"
    },
    {
      "url": "https://cert-portal.siemens.com/productcert/html/ssa-082556.html",
      "source": "0b142b55-0307-4c5a-b3c9-f314f3fb7c5e"
    },
    {
      "url": "https://cert-portal.siemens.com/productcert/html/ssa-457936.html",
      "source": "0b142b55-0307-4c5a-b3c9-f314f3fb7c5e"
    }
  ]
}