diff options
| author | Davidlohr Bueso <dave@stgolabs.net> | 2026-02-02 11:13:30 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-04-02 13:25:12 +0200 |
| commit | f1b4741adf08b0063291ec1b0dfa9c3d55644933 (patch) | |
| tree | 8852a28b947b7671495d20396a6eab64817ccb6d /drivers/cxl/core | |
| parent | f7dc6f381a1e5f068333f1faa9265d6af1df4235 (diff) | |
cxl/region: Fix leakage in __construct_region()
[ Upstream commit 77b310bb7b5ff8c017524df83292e0242ba89791 ]
Failing the first sysfs_update_group() needs to explicitly
kfree the resource as it is too early for cxl_region_iomem_release()
to do so.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
Fixes: d6602e25819d (cxl/region: Add support to indicate region has extended linear cache)
Link: https://patch.msgid.link/20260202191330.245608-1-dave@stgolabs.net
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/cxl/core')
| -rw-r--r-- | drivers/cxl/core/region.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 5bd1213737fa..a3d06b852d05 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -3616,8 +3616,10 @@ static int __construct_region(struct cxl_region *cxlr, } rc = sysfs_update_group(&cxlr->dev.kobj, &cxl_region_group); - if (rc) + if (rc) { + kfree(res); return rc; + } rc = insert_resource(cxlrd->res, res); if (rc) { |
