Linux CXL
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Artem Dinaburg" <artem@trailofbits.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH 6.6.y] cxl/mem: Fix no cxl_nvd during pmem region auto-assembling
Date: Tue, 29 Sep 2026 03:16:32 +0000	[thread overview]
Message-ID: <20260929031633.38DF71F008A0@smtp.kernel.org> (raw)
In-Reply-To: <20260929030716.86736-1-artem@trailofbits.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] cxl: fatal probe failure when PMEM is disabled by platform
--

commit 3836a307f91efffcbe3c18ffddeb397cd4ef78b8
Author: Li Ming <ming4.li@intel.com>

cxl/mem: Fix no cxl_nvd during pmem region auto-assembling

When the CXL subsystem is auto-assembling a pmem region during cxl endpoint
port probing, it can hit a null pointer dereference. The cxl_nvd of the
memdev needs to be available during the pmem region probe, so this patch
adjusts the sequence to register the nvdimm bridge earlier.

Link: https://patch.msgid.link/20240612064423.2567625-1-ming4.li@intel.com

> diff --git a/drivers/cxl/mem.c b/drivers/cxl/mem.c
> index 317c7548e4e9b..3400d2f2a5ff9 100644
> --- a/drivers/cxl/mem.c
> +++ b/drivers/cxl/mem.c
> @@ -153,6 +153,16 @@ static int cxl_mem_probe(struct device *dev)
>  		return -ENXIO;
>  	}
>  
> +	if (resource_size(&cxlds->pmem_res) && IS_ENABLED(CONFIG_CXL_PMEM)) {
> +		rc = devm_cxl_add_nvdimm(parent_port, cxlmd);
> +		if (rc) {
> +			if (rc == -ENODEV)
> +				dev_info(dev, "PMEM disabled by platform\n");
> +			put_device(&parent_port->dev);
> +			return rc;

[Severity: High]
Can returning an error here inadvertently cause a fatal probe failure when
the platform disables PMEM?

If a CXL memory expander has a PMEM region but the platform lacks an NVDIMM
bridge, devm_cxl_add_nvdimm() correctly returns -ENODEV.

The new code catches this and logs "PMEM disabled by platform", but then
it unconditionally returns rc. Returning an error here fails the entire
cxl_mem driver probe, meaning the device is rejected and its endpoint is
never registered.

This renders the device completely unusable, blocking access to both its
persistent and volatile memory. The old code correctly swallowed the -ENODEV
error to allow continued probing.

> +		}
> +	}
> +
>  	if (dport->rch)
>  		endpoint_parent = parent_port->uport_dev;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929030716.86736-1-artem@trailofbits.com?part=1

  reply	other threads:[~2026-09-29  3:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  3:07 [PATCH 6.6.y] cxl/mem: Fix no cxl_nvd during pmem region auto-assembling Artem Dinaburg
2026-09-29  3:16 ` sashiko-bot [this message]
2026-09-29 18:50 ` Sasha Levin

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=20260929031633.38DF71F008A0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=artem@trailofbits.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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