Skip to content

Commit f04facf

Browse files
fancxldjbw
authored andcommitted
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: 384e624 ("cxl/region: Attach endpoint decoders") Signed-off-by: Fan Ni <fan.ni@samsung.com> Link: https://lore.kernel.org/r/20221107212153.745993-1-fan.ni@samsung.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 9b5f77e commit f04facf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/cxl/core/region.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ static int cxl_region_attach(struct cxl_region *cxlr,
12261226
struct cxl_endpoint_decoder *cxled_target;
12271227
struct cxl_memdev *cxlmd_target;
12281228

1229-
cxled_target = p->targets[pos];
1229+
cxled_target = p->targets[i];
12301230
if (!cxled_target)
12311231
continue;
12321232

0 commit comments

Comments
 (0)