Commit f04facfb authored by Fan Ni's avatar Fan Ni Committed by Dan Williams

cxl/region: Fix memdev reuse check

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: <stable@vger.kernel.org>
Fixes: 384e624b ("cxl/region: Attach endpoint decoders")
Signed-off-by: default avatarFan Ni <fan.ni@samsung.com>
Link: https://lore.kernel.org/r/20221107212153.745993-1-fan.ni@samsung.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 9b5f77ef
...@@ -1226,7 +1226,7 @@ static int cxl_region_attach(struct cxl_region *cxlr, ...@@ -1226,7 +1226,7 @@ static int cxl_region_attach(struct cxl_region *cxlr,
struct cxl_endpoint_decoder *cxled_target; struct cxl_endpoint_decoder *cxled_target;
struct cxl_memdev *cxlmd_target; struct cxl_memdev *cxlmd_target;
cxled_target = p->targets[pos]; cxled_target = p->targets[i];
if (!cxled_target) if (!cxled_target)
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment