From: Davidlohr Bueso <dave@stgolabs.net>
To: Ira Weiny <ira.weiny@intel.com>
Cc: dave.jiang@intel.com, jonathan.cameron@huawei.com,
alison.schofield@intel.com, vishal.l.verma@intel.com,
dan.j.williams@intel.com, linux-cxl@vger.kernel.org
Subject: Re: [PATCH] cxl/region: Fix leakage in __construct_region()
Date: Mon, 9 Feb 2026 11:52:55 -0800 [thread overview]
Message-ID: <20260209195255.24egy2aywdfrt4in@offworld> (raw)
In-Reply-To: <698a380971da0_c11ee1006a@iweiny-mobl.notmuch>
On Mon, 09 Feb 2026, Ira Weiny wrote:
>Davidlohr Bueso wrote:
>> 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>
>> ---
>> drivers/cxl/core/region.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>> index 96888d87a8df..28d70497283d 100644
>> --- a/drivers/cxl/core/region.c
>> +++ b/drivers/cxl/core/region.c
>> @@ -3795,8 +3795,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) {
>
>There is another call to sysfs_update_group() with potential failure after
>the insert_resource(). Does that need to be handled? Or is the resource
>turned over to the root decoder at that point?
>
>Assuming it is ok.
Yes, the second call failure is after the region param p->res = res
so taken care of in cxl_region_iomem_release().
>Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Thanks!
next prev parent reply other threads:[~2026-02-09 20:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 19:13 [PATCH] cxl/region: Fix leakage in __construct_region() Davidlohr Bueso
2026-02-02 19:16 ` Davidlohr Bueso
2026-02-02 19:24 ` Gregory Price
2026-02-02 22:00 ` Alison Schofield
2026-02-09 18:58 ` Davidlohr Bueso
2026-02-09 19:39 ` Ira Weiny
2026-02-09 19:52 ` Davidlohr Bueso [this message]
2026-03-04 17:14 ` Davidlohr Bueso
2026-03-04 17:28 ` Dave Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260209195255.24egy2aywdfrt4in@offworld \
--to=dave@stgolabs.net \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox