diff options
author | Dan Williams <dan.j.williams@intel.com> | 2023-02-10 12:06:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-11-28 20:07:17 +0300 |
commit | 008b08ab077371a3069726a963c4e1903f4d956e (patch) | |
tree | 6b349ce72e97c419ca8774f146e91ede0866e456 /drivers/cxl | |
parent | 93d242f63ed39f5742160ddc9b89a5c16e3fd9b6 (diff) | |
download | linux-008b08ab077371a3069726a963c4e1903f4d956e.tar.xz |
cxl/region: Cleanup target list on attach error
[ Upstream commit 86987c766276acf1289700cd38bd6d5b5a167fea ]
Jonathan noticed that the target list setup is not unwound completely
upon error. Undo all the setup in the 'err_decrement:' exit path.
Fixes: 27b3f8d13830 ("cxl/region: Program target lists")
Reported-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Link: http://lore.kernel.org/r/20230208123031.00006990@Huawei.com
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/167601996980.1924368.390423634911157277.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Stable-dep-of: 0718588c7aaa ("cxl/region: Do not try to cleanup after cxl_region_setup_targets() fails")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/cxl')
-rw-r--r-- | drivers/cxl/core/region.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 99b0501066e5..bd1c511bba98 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -1317,6 +1317,8 @@ static int cxl_region_attach(struct cxl_region *cxlr, err_decrement: p->nr_targets--; + cxled->pos = -1; + p->targets[pos] = NULL; err: for (iter = ep_port; !is_cxl_root(iter); iter = to_cxl_port(iter->dev.parent)) |