{"id":"CVE-2026-31530","aliases":["CVE-2026-31530"],"related":[],"kind":"vulnerability","state":"published","title":"cxl/port: Fix use after free of parent_port in cxl_detach_ep()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ncxl/port: Fix use after free of parent_port in cxl_detach_ep()\n\ncxl_detach_ep() is called during bottom-up removal when all CXL memory\ndevices beneath a switch port have been removed. For each port in the\nhierarchy it locks both the port and its parent, removes the endpoint,\nand if the port is now empty, marks it dead and unregisters the port\nby calling delete_switch_port(). There are two places during this work\nwhere the parent_port may be used after freeing:\n\nFirst, a concurrent detach may have already processed a port by the\ntime a second worker finds it via bus_find_device(). Without pinning\nparent_port, it may already be freed when we discover port->dead and\nattempt to unlock the parent_port. In a production kernel that's a\nsilent memory corruption, with lock debug, it looks like this:\n\n[]DEBUG_LOCKS_WARN_ON(__owner_task(owner) != get_current())\n[]WARNING: kernel/locking/mutex.c:949 at __mutex_unlock_slowpath+0x1ee/0x310\n[]Call Trace:\n[]mutex_unlock+0xd/0x20\n[]cxl_detach_ep+0x180/0x400 [cxl_core]\n[]devm_action_release+0x10/0x20\n[]devres_release_all+0xa8/0xe0\n[]device_unbind_cleanup+0xd/0xa0\n[]really_probe+0x1a6/0x3e0\n\nSecond, delete_switch_port() releases three devm actions registered\nagainst parent_port. The last of those is unregister_port() and it\ncalls device_unregister() on the child port, which can cascade. If\nparent_port is now also empty the device core may unregister and free\nit too. So by the time delete_switch_port() returns, parent_port may\nbe free, and the subsequent device_unlock(&parent_port->dev) operates\non freed memory. The kernel log looks same as above, with a different\noffset in cxl_detach_ep().\n\nBoth of these issues stem from the absence of a lifetime guarantee\nbetween a child port and its parent port.\n\nEstablish a lifetime rule for ports: child ports hold a reference to\ntheir parent device until release. Take the reference when the port\nis allocated and drop it when released. This ensures the parent is\nvalid for the full lifetime of the child and eliminates the use after\nfree window in cxl_detach_ep().\n\nThis is easily reproduced with a reload of cxl_acpi in QEMU with CXL\ndevices present.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ncxl/port: Fix use after free of parent_port in cxl_detach_ep()\n\ncxl_detach_ep() is called during bottom-up removal when all CXL memory\ndevices beneath a switch port have been removed. For each port in the\nhierarchy it locks both the port and its parent, removes the endpoint,\nand if the port is now empty, marks it dead and unregisters the port\nby calling delete_switch_port(). There are two places during this work\nwhere the parent_port may be used after freeing:\n\nFirst, a concurrent detach may have already processed a port by the\ntime a second worker finds it via bus_find_device(). Without pinning\nparent_port, it may already be freed when we discover port->dead and\nattempt to unlock the parent_port. In a production kernel that's a\nsilent memory corruption, with lock debug, it looks like this:\n\n[]DEBUG_LOCKS_WARN_ON(__owner_task(owner) != get_current())\n[]WARNING: kernel/locking/mutex.c:949 at __mutex_unlock_slowpath+0x1ee/0x310\n[]Call Trace:\n[]mutex_unlock+0xd/0x20\n[]cxl_detach_ep+0x180/0x400 [cxl_core]\n[]devm_action_release+0x10/0x20\n[]devres_release_all+0xa8/0xe0\n[]device_unbind_cleanup+0xd/0xa0\n[]really_probe+0x1a6/0x3e0\n\nSecond, delete_switch_port() releases three devm actions registered\nagainst parent_port. The last of those is unregister_port() and it\ncalls device_unregister() on the child port, which can cascade. If\nparent_port is now also empty the device core may unregister and free\nit too. So by the time delete_switch_port() returns, parent_port may\nbe free, and the subsequent device_unlock(&parent_port->dev) operates\non freed memory. The kernel log looks same as above, with a different\noffset in cxl_detach_ep().\n\nBoth of these issues stem from the absence of a lifetime guarantee\nbetween a child port and its parent port.\n\nEstablish a lifetime rule for ports: child ports hold a reference to\ntheir parent device until release. Take the reference when the port\nis allocated and drop it when released. This ensures the parent is\nvalid for the full lifetime of the child and eliminates the use after\nfree window in cxl_detach_ep().\n\nThis is easily reproduced with a reload of cxl_acpi in QEMU with CXL\ndevices present.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\ncxl/port: Corrección de uso después de liberación de parent_port en cxl_detach_ep()\n\ncxl_detach_ep() es llamada durante la eliminación de abajo hacia arriba cuando todos los dispositivos de memoria CXL debajo de un puerto de switch han sido eliminados. Para cada puerto en la jerarquía, bloquea tanto el puerto como su padre, elimina el punto final, y si el puerto ahora está vacío, lo marca como muerto y anula el registro del puerto llamando a delete_switch_port(). Hay dos lugares durante este trabajo donde parent_port puede ser usado después de su liberación:\n\nPrimero, una desconexión concurrente puede haber procesado ya un puerto para cuando un segundo trabajador lo encuentra a través de bus_find_device(). Sin fijar parent_port, puede que ya esté liberado cuando descubrimos port  ->  dead e intentamos desbloquear parent_port. En un kernel de producción eso es una corrupción de memoria silenciosa, con depuración de bloqueo, se ve así:\n\nDEBUG_LOCKS_WARN_ON(__owner_task(owner) != get_current())\nWARNING: kernel/locking/mutex.c:949 at __mutex_unlock_slowpath+0x1ee/0x310\nTraza de Llamada:\nmutex_unlock+0xd/0x20\ncxl_detach_ep+0x180/0x400 [cxl_core]\ndevm_action_release+0x10/0x20\ndevres_release_all+0xa8/0xe0\ndevice_unbind_cleanup+0xd/0xa0\nreally_probe+0x1a6/0x3e0\n\nSegundo, delete_switch_port() libera tres acciones devm registradas contra parent_port. La última de ellas es unregister_port() y llama a device_unregister() en el puerto hijo, lo que puede generar una cascada. Si parent_port ahora también está vacío el núcleo del dispositivo puede anular su registro y liberarlo también. Así que para cuando delete_switch_port() regresa, parent_port puede estar libre, y el subsiguiente device_unlock(ref:parent_port  ->  dev) opera sobre memoria liberada. El registro del kernel se ve igual que el anterior, con un desplazamiento diferente en cxl_detach_ep().\n\nAmbos de estos problemas provienen de la ausencia de una garantía de vida útil entre un puerto hijo y su puerto padre.\n\nEstablecer una regla de vida útil para los puertos: los puertos hijos mantienen una referencia a su dispositivo padre hasta su liberación. Tomar la referencia cuando el puerto es asignado y soltarla cuando es liberado. Esto asegura que el padre sea válido durante toda la vida útil del hijo y elimina la ventana de uso después de liberación en cxl_detach_ep().\n\nEsto se reproduce fácilmente con una recarga de cxl_acpi en QEMU con dispositivos CXL presentes.","source":"nvd"}],"published":"2026-04-22T13:54:42.563Z","modified":"2026-11-11T23:10:00.263Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-416"],"affected":[{"ranges":[{"type":"git","introduced":"2345df54249c6fb7779e2a72b427ee79ed3eaad5","fixed":"b1f62588ab1be6c9535d74348003c86b47ec4abd","status":"affected"},{"type":"git","introduced":"2345df54249c6fb7779e2a72b427ee79ed3eaad5","fixed":"d216a4bd138eb57cc4ae7c43b2f709e3482af7e2","status":"affected"},{"type":"git","introduced":"2345df54249c6fb7779e2a72b427ee79ed3eaad5","fixed":"2c32141462045cf93d54a5146a0ba572b83533dd","status":"affected"},{"type":"git","introduced":"2345df54249c6fb7779e2a72b427ee79ed3eaad5","fixed":"f7dc6f381a1e5f068333f1faa9265d6af1df4235","status":"affected"},{"type":"git","introduced":"2345df54249c6fb7779e2a72b427ee79ed3eaad5","fixed":"19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.3","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.3","status":"unaffected"},{"type":"semver","introduced":"6.6.160","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.80","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.21","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"6.19.11","lastAffected":"6.19.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.0","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"6.3","fixed":"6.12.80"},{"status":"affected","introduced":"6.13","fixed":"6.18.21"},{"status":"affected","introduced":"6.19","fixed":"6.19.11"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/b1f62588ab1be6c9535d74348003c86b47ec4abd","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/d216a4bd138eb57cc4ae7c43b2f709e3482af7e2","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2c32141462045cf93d54a5146a0ba572b83533dd","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f7dc6f381a1e5f068333f1faa9265d6af1df4235","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-11-05T21:37:47.922Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31530","url":"https://www.cve.org/CVERecord?id=CVE-2026-31530","licence":"CVE Terms of Use","modified":"2026-11-05T21:45:06.495Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31530","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31530","licence":"Public domain","modified":"2026-11-11T23:10:00.263Z"}],"updatedAt":"2026-11-25T22:59:19.314Z","epss":{"score":0.00165,"percentile":0.05965,"date":"2026-12-01T12:00:22.000Z"}}