Skip to content

Commit 1c987cf

Browse files
zhijianli88davejiang
authored andcommitted
cxl/region: Fix cxlr_pmem leaks
Before this error path, cxlr_pmem pointed to a kzalloc() memory, free it to avoid this memory leaking. Fixes: f17b558 ("cxl/pmem: Refactor nvdimm device registration, delete the workqueue") Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20240428030748.318985-1-lizhijian@fujitsu.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 660c0a8 commit 1c987cf

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/cxl/core/region.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,6 +2854,7 @@ static struct cxl_pmem_region *cxl_pmem_region_alloc(struct cxl_region *cxlr)
28542854
if (i == 0) {
28552855
cxl_nvb = cxl_find_nvdimm_bridge(cxlmd);
28562856
if (!cxl_nvb) {
2857+
kfree(cxlr_pmem);
28572858
cxlr_pmem = ERR_PTR(-ENODEV);
28582859
goto out;
28592860
}

0 commit comments

Comments
 (0)