]> Git Repo - linux.git/commitdiff
cxl/region: Fix memdev reuse check
authorFan Ni <[email protected]>
Mon, 7 Nov 2022 21:22:31 +0000 (21:22 +0000)
committerDan Williams <[email protected]>
Thu, 8 Dec 2022 21:03:47 +0000 (13:03 -0800)
Due to a typo, the check of whether or not a memdev has already been
used as a target for the region (above code piece) will always be
skipped. Given a memdev with more than one HDM decoder, an interleaved
region can be created that maps multiple HPAs to the same DPA. According
to CXL spec 3.0 8.1.3.8.4, "Aliasing (mapping more than one Host
Physical Address (HPA) to a single Device Physical Address) is
forbidden."

Fix this by using existing iterator for memdev reuse check.

Cc: <[email protected]>
Fixes: 384e624bb211 ("cxl/region: Attach endpoint decoders")
Signed-off-by: Fan Ni <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Dan Williams <[email protected]>
drivers/cxl/core/region.c

index f8c36f4a942216f387c1dead033f8bc9107bf3ad..02f28da519e351de759768818f6641c153b5ca79 100644 (file)
@@ -1226,7 +1226,7 @@ static int cxl_region_attach(struct cxl_region *cxlr,
                struct cxl_endpoint_decoder *cxled_target;
                struct cxl_memdev *cxlmd_target;
 
-               cxled_target = p->targets[pos];
+               cxled_target = p->targets[i];
                if (!cxled_target)
                        continue;
 
This page took 0.058697 seconds and 4 git commands to generate.