From: Gregory Price <gourry@gourry.net>
To: Dave Jiang <dave.jiang@intel.com>
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: Mon, 23 Feb 2026 17:18:27 -0500 [thread overview]
Message-ID: <aZzSMwc2evqS8uBc@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <20260213224038.549798-3-dave.jiang@intel.com>
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
~Gregory
next prev parent reply other threads:[~2026-02-23 22:18 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 [this message]
2026-02-24 15:35 ` Dave Jiang
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=aZzSMwc2evqS8uBc@gourry-fedora-PF4VCD3F \
--to=gourry@gourry.net \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.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