Skip to content

Commit 77b310b

Browse files
Davidlohr Buesodavejiang
authored andcommitted
cxl/region: Fix leakage in __construct_region()
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: d6602e2 (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>
1 parent 19d2f0b commit 77b310b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/cxl/core/region.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3854,8 +3854,10 @@ static int __construct_region(struct cxl_region *cxlr,
38543854
}
38553855

38563856
rc = sysfs_update_group(&cxlr->dev.kobj, &cxl_region_group);
3857-
if (rc)
3857+
if (rc) {
3858+
kfree(res);
38583859
return rc;
3860+
}
38593861

38603862
rc = insert_resource(cxlrd->res, res);
38613863
if (rc) {

0 commit comments

Comments
 (0)