Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Alison Schofield <alison.schofield@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jic23@kernel.org>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <iweiny@kernel.org>, Li Ming <ming.li@zohomail.com>,
	Richard Cheng <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v4 1/2] cxl/region: Reject a repeat write of an endpoint decoder to targetN
Date: Mon, 16 Nov 2026 15:12:55 -0700	[thread overview]
Message-ID: <bb4de306-58e1-4e37-96bb-d211dae984e9@intel.com> (raw)
In-Reply-To: <e8235faea3d75dbfd45f197fe657c467b6259705.1793724885.git.alison.schofield@intel.com>



On 11/3/26 10:07 AM, Alison Schofield wrote:
> Writing an endpoint decoder to a region targetN attribute that already
> holds it returns -EBUSY, but leaves the partially populated region in an
> inconsistent state. The targetN attribute still names the decoder, so the
> failed write gives no indication that the region was damaged.
> 
> Filling the remaining target positions can then trigger a NULL pointer
> dereference in cxl_region_setup_targets(). This can be reproduced through
> sysfs:
> 
>     echo $decoder > /sys/bus/cxl/devices/region0/target0
>     echo $decoder > /sys/bus/cxl/devices/region0/target0
>     echo $other_decoder > /sys/bus/cxl/devices/region0/target1
> 
> An existing check recognizes the repeated assignment but incorrectly allows
> the attachment to proceed, damaging region state. Remove that check so the
> repeated write is rejected without disturbing the existing attachment,
> consistent with the documented targetN ABI.
> 
> Fixes: 9995576cef48 ("cxl/region: Move region-position validation to a helper")
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Applied to cxl/fixes (only this patch, not 2/2)
b8183f9259b5

> ---
> 
> Note: cxl_region_perf_data_calculate() currently updates region performance
> data before attachment validation completes. This is a pre-existing issue
> that will be addressed separately.
> 
> Changes in v4:
> - Drop the added useless check in cxl_region_attach() (Sashiko)
>   The pre-existing occupied position check already returns -EBUSY.
> v3: https://lore.kernel.org/linux-cxl/3e5af9d6d59f8df52b9d21bcf1c7e78f06918f80.1793653629.git.alison.schofield@intel.com/
> 
> Changes in v3:
> - Reject repeat writes with -EBUSY, consistent with the documented ABI
> - Rebase on 7.4-rc1
> v2: https://lore.kernel.org/linux-cxl/920d80735a449f93a1f17a8bca4c25e4b302cb42.1792989098.git.alison.schofield@intel.com/
> 
> Changes in v2:
> - Preserve the successful no-op behavior for repeated writes (Jonathan)
> - Correct the Fixes tag
> v1: https://lore.kernel.org/linux-cxl/94e9157aac2e99df1251d733769d539b914fdefc.1790829690.git.alison.schofield@intel.com/
> ---
>  drivers/cxl/core/region.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index a048bd5c06cb..f42c6b6e3213 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -1764,9 +1764,6 @@ static int cxl_region_validate_position(struct cxl_region *cxlr,
>  		return -ENXIO;
>  	}
>  
> -	if (p->targets[pos] == cxled)
> -		return 0;
> -
>  	if (p->targets[pos]) {
>  		struct cxl_endpoint_decoder *cxled_target = p->targets[pos];
>  		struct cxl_memdev *cxlmd_target = cxled_to_memdev(cxled_target);
> 
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4


      parent reply	other threads:[~2026-11-16 22:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 17:07 [PATCH v4 1/2] cxl/region: Reject a repeat write of an endpoint decoder to targetN Alison Schofield
2026-11-03 17:07 ` [PATCH v4 2/2] cxl/Documentation: Describe clearing a region targetN position Alison Schofield
2026-11-03 23:07   ` Dave Jiang
2026-11-04  3:19     ` Alison Schofield
2026-11-03 21:27 ` [PATCH v4 1/2] cxl/region: Reject a repeat write of an endpoint decoder to targetN Cheatham, Benjamin
2026-11-03 23:06 ` Dave Jiang
2026-11-11 19:47 ` Jonathan Cameron
2026-11-16 22:12 ` Dave Jiang [this message]

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=bb4de306-58e1-4e37-96bb-d211dae984e9@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave@stgolabs.net \
    --cc=icheng@nvidia.com \
    --cc=iweiny@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=ming.li@zohomail.com \
    --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