From: Dave Jiang <dave.jiang@intel.com>
To: Gregory Price <gourry@gourry.net>
Cc: linux-cxl@vger.kernel.org, dave@stgolabs.net,
jonathan.cameron@huawei.com, alison.schofield@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com,
dan.j.williams@intel.com
Subject: Re: [PATCH v3 2/2] cxl: Fix race of nvdimm_bus object when creating nvdimm objects
Date: Tue, 24 Feb 2026 08:35:36 -0700 [thread overview]
Message-ID: <03fd10b3-9fd3-4f6d-983c-a0fe1491463a@intel.com> (raw)
In-Reply-To: <aZzSMwc2evqS8uBc@gourry-fedora-PF4VCD3F>
On 2/23/26 3:18 PM, Gregory Price wrote:
> On Fri, Feb 13, 2026 at 03:40:38PM -0700, Dave Jiang wrote:
>> @@ -248,6 +262,19 @@ int devm_cxl_add_nvdimm(struct device *host, struct cxl_port *port,
>> if (!cxl_nvb)
>> return -ENODEV;
>>
>> + /*
>> + * Take the uport_dev lock to guard against race of nvdimm_bus object.
>> + * cxl_acpi_probe() registers the nvdimm_bus and is done under the
>> + * root port uport_dev lock.
>> + *
>> + * Take the cxl_nvb device lock to ensure that cxl_nvb driver is in a
>> + * consistent state. And the driver registers nvdimm_bus.
>> + */
>> + guard(device)(cxl_nvb->port->uport_dev);
>> + guard(device)(&cxl_nvb->dev);
>> + if (!cxl_nvb->nvdimm_bus)
>> + return -ENODEV;
>> +
>
> I think this leaks the reference on cxl_nvb taken by
>
> devm_cxl_add_nvdimm()
> device_find_child()
>
> Maybe:
> if (!cxl_nvb->nvdimm_bus) {
> rc = -ENODEV;
> goto err_alloc;
> }
>
>
> Reported-by: kreview-0811365
Thanks! I've fixed it up in place in cxl/fixes.
>
> ~Gregory
next prev parent reply other threads:[~2026-02-24 15:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 22:40 [PATCH v3 0/2] cxl: Fix nvdimm_bus race for nvdimm devices Dave Jiang
2026-02-13 22:40 ` [PATCH v3 1/2] cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko Dave Jiang
2026-02-14 4:33 ` kernel test robot
2026-02-14 4:51 ` kernel test robot
2026-02-13 22:40 ` [PATCH v3 2/2] cxl: Fix race of nvdimm_bus object when creating nvdimm objects Dave Jiang
2026-02-23 22:18 ` Gregory Price
2026-02-24 15:35 ` Dave Jiang [this message]
2026-02-23 22:37 ` [PATCH v3 0/2] cxl: Fix nvdimm_bus race for nvdimm devices 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=03fd10b3-9fd3-4f6d-983c-a0fe1491463a@intel.com \
--to=dave.jiang@intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=gourry@gourry.net \
--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