Commit 77b310bb authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Dave Jiang
Browse files

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: default avatarDavidlohr Bueso <dave@stgolabs.net>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarGregory Price <gourry@gourry.net>
Fixes: d6602e25 (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: default avatarDave Jiang <dave.jiang@intel.com>
parent 19d2f0b9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3854,8 +3854,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) {