All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] cxl/region: Fix two decoder attach/detach issues for auto-assembly region
@ 2026-06-06  7:50 Li Ming
  2026-06-06  7:51 ` [PATCH 1/2] cxl/region: Fix out-of-bounds access in cxl_cancel_auto_attach() Li Ming
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Li Ming @ 2026-06-06  7:50 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl, linux-kernel, Li Ming

This patchset includes two fixes for endpoint decoder attach/detach for
auto-assembly region.

Patch #1 fixes OOB access in cxl_cancel_auto_attach().

Patch #2 fixes NULL endpoint pointers hole in p->targets[]. CXL driver
does not allow any NULL pointer hole in p->targets[], it will cause
NULL pointer dereference issue. However, if an assigned endpoint decoder
is removed from an auto-assembly region, it could make it happen.

The following operations can always trigger NULL pointer hole issue.
Precondition:
an auto-assembly region with LOCK flags or its assigned endpoint
decoders with LOCK flags. This means these assigned endpoint decoders
could be re-attached to the region after being detached.

echo {one of cxl pci BDF} > /sys/bus/pci/drivers/cxl_pci/unbind
echo {one of cxl pci BDF} > /sys/bus/pci/drivers/cxl_pci/bind

it will trigger the NUll pointer dereference issuse fixed by patch #2.

Note: Patch #2 only fixes NULL pointer dereference issue, re-attaching
a removal endpoint decoder to the auto-assembly region still fails
with the patch, because there are other issues blocking re-attachment
flow. One of them is that re-attachment will trigger calling
cxl_region_attach_position() for each targets in p->targets[] again, but
the function fails on the targets which have been attached. I am not
sure whether re-attachment is a valid user usage, if yes, I will work on
that later.

Signed-off-by: Li Ming <ming.li@zohomail.com>
---
Li Ming (2):
      cxl/region: Fix out-of-bounds access in cxl_cancel_auto_attach()
      cxl/region: Fill first free targets[] slot during auto-discovery

 drivers/cxl/core/region.c | 55 ++++++++++++++++++++++++++++-------------------
 1 file changed, 33 insertions(+), 22 deletions(-)
---
base-commit: a1516711b95490ad6c9f05b61500e73d4f603d28
change-id: 20260606-fix_two_issues_introduced_by_cxl_cancel_auto_attach-6267f4fdce27

Best regards,
-- 
Li Ming <ming.li@zohomail.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-06-12 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-06  7:50 [PATCH 0/2] cxl/region: Fix two decoder attach/detach issues for auto-assembly region Li Ming
2026-06-06  7:51 ` [PATCH 1/2] cxl/region: Fix out-of-bounds access in cxl_cancel_auto_attach() Li Ming
2026-06-12  1:19   ` Alison Schofield
2026-06-06  7:51 ` [PATCH 2/2] cxl/region: Fill first free targets[] slot during auto-discovery Li Ming
2026-06-06  8:11   ` sashiko-bot
2026-06-08  4:38     ` Li Ming
2026-06-12  1:19       ` Alison Schofield
2026-06-12  1:20   ` Alison Schofield
2026-06-12 16:40 ` [PATCH 0/2] cxl/region: Fix two decoder attach/detach issues for auto-assembly region Dave Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.