summaryrefslogtreecommitdiff
path: root/drivers/cxl
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-08-01 13:20:58 +0300
committerDan Williams <dan.j.williams@intel.com>2022-08-02 00:24:34 +0300
commit5e42bcbc3fef6e759dfb4d3f4cfb394c382b4249 (patch)
tree65adbd2b65a7e3cfe567902be3a2625e779a6906 /drivers/cxl
parentc7e3548cac4a8a8bc1ad183cc7c7249463dff55f (diff)
downloadlinux-5e42bcbc3fef6e759dfb4d3f4cfb394c382b4249.tar.xz
cxl/region: decrement ->nr_targets on error in cxl_region_attach()
The ++ needs a match -- on the clean up path. If the p->nr_targets value gets to be more than 16 it leads to uninitialized data in cxl_port_setup_targets(). drivers/cxl/core/region.c:995 cxl_port_setup_targets() error: uninitialized symbol 'eiw'. Fixes: 27b3f8d13830 ("cxl/region: Program target lists") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YuepCvUAoCtdpcoO@kili Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/cxl')
-rw-r--r--drivers/cxl/core/region.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 516ba7e2de81..55691f6e97d6 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -1218,12 +1218,14 @@ static int cxl_region_attach(struct cxl_region *cxlr,
if (p->nr_targets == p->interleave_ways) {
rc = cxl_region_setup_targets(cxlr);
if (rc)
- goto err;
+ goto err_decrement;
p->state = CXL_CONFIG_ACTIVE;
}
return 0;
+err_decrement:
+ p->nr_targets--;
err:
for (iter = ep_port; !is_cxl_root(iter);
iter = to_cxl_port(iter->dev.parent))