diff options
| author | Dave Jiang <dave.jiang@intel.com> | 2026-10-01 08:47:44 -0700 |
|---|---|---|
| committer | Dave Jiang <dave.jiang@intel.com> | 2026-10-09 14:08:13 -0700 |
| commit | bcda00c78d075340fe30cb6c980507fac711e7d1 (patch) | |
| tree | 3535561fe8e34564d16d59d57abca41d1fce22f3 /tools/perf/scripts/python/export-to-sqlite.py | |
| parent | b72a03ebd9586d59992ecaa6ceed11ea96835734 (diff) | |
| download | linux-next-bcda00c78d075340fe30cb6c980507fac711e7d1.tar.gz linux-next-bcda00c78d075340fe30cb6c980507fac711e7d1.zip | |
cxl/port: Attach endpoints to a dport under the lock that pins it
devm_cxl_enumerate_ports() and add_port_attach_ep() look up or create a
dport under its port's device lock, drop the lock, then pass the dport
to cxl_add_ep(). add_ep() reads dport->port before taking the lock, and
cxl_gpf_port_setup() reads and writes the dport with no lock held.
A concurrent cxl_detach_ep() for another memdev below the same port can
free the dport in that window: it calls del_dports() under the port lock
when the last endpoint leaves. The enumerating memdev then dereferences
freed memory.
Attach the endpoint and set up GPF while the port lock from the lookup
is still held. Make add_ep() assert that lock instead of taking it.
Under the lock, a dport found in port->dports is still live, since
removal erases it from the xarray before freeing it.
[ dj: Added kdoc update from Alison. ]
Fixes: de516b40116e ("cxl/port: Record dport in endpoint references")
Reported-by: Li Ming <ming.li@zohomail.com>
Closes: https://lore.kernel.org/linux-cxl/0c68324c-cfc7-46b2-9344-24ae40e88923@zohomail.com/
Assisted-by: LLM
Reviewed-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Link: https://patch.msgid.link/20261001154744.1095902-4-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions
