From: sashiko-bot@kernel.org
To: "Alison Schofield" <alison.schofield@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH 3/3] cxl/hdm: Restore commit_end when decoder enumeration fails
Date: Mon, 13 Jul 2026 20:58:20 +0000 [thread overview]
Message-ID: <20260713205821.736541F000E9@smtp.kernel.org> (raw)
In-Reply-To: <dd46f240738e3eb2663b23ed79fd9544ff5dccfa.1783974681.git.alison.schofield@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Transient reset of `port->commit_end` allows concurrent bypass of safety checks in `cxl_mem_sanitize`, potentially destroying active memory.
--
--- Patch [3]: [PATCH 3/3] cxl/hdm: Restore commit_end when decoder enumeration fails ---
commit 0d7f87c9ca0ba7b9bbdd31e5ea90994445b1c9b5
Author: Alison Schofield <alison.schofield@intel.com>
cxl/hdm: Restore commit_end when decoder enumeration fails
This commit resets port->commit_end to -1 before enumerating decoders so
the commit state is rebuilt from the decoders actually committed on each
probe. This prevents previous enumeration failures from causing subsequent
probes to fail.
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index 75d17120233da..0145d3db31070 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -1178,6 +1178,10 @@ static int devm_cxl_enumerate_decoders(struct cxl_hdm *cxlhdm,
>
> cxl_settle_decoders(cxlhdm);
>
> + /* Reset to the none committed baseline for a fresh enumeration */
> + scoped_guard(rwsem_write, &cxl_rwsem.region)
> + port->commit_end = -1;
[Severity: High]
Does this scoped_guard drop the lock too early?
Because scoped_guard only holds the lock for the following single statement,
the rwsem_write lock is released immediately after setting port->commit_end
to -1. This leaves the transient -1 state exposed to readers without protection
while the loop below performs the hardware enumeration.
Could a concurrent reader like cxl_mem_sanitize() acquire the read lock
during this window, observe a temporarily empty committed decoder count
(since cxl_num_decoders_committed() evaluates the exposed -1), and
erroneously bypass its safety checks to securely erase actively mapped memory?
> +
> for (i = 0; i < cxlhdm->decoder_count; i++) {
> int rc, target_count = cxlhdm->target_count;
> struct cxl_decoder *cxld;
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783974681.git.alison.schofield@intel.com?part=3
prev parent reply other threads:[~2026-07-13 20:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 20:44 [PATCH 0/3] Harden HDM decoder enumeration Alison Schofield
2026-07-13 20:44 ` [PATCH 1/3] cxl/hdm: Reject switch decoder interleave ways that overflow targets Alison Schofield
2026-07-13 21:00 ` sashiko-bot
2026-07-13 20:44 ` [PATCH 2/3] cxl/hdm: Make switch decoder target parsing endian-safe Alison Schofield
2026-07-13 20:44 ` [PATCH 3/3] cxl/hdm: Restore commit_end when decoder enumeration fails Alison Schofield
2026-07-13 20:58 ` sashiko-bot [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=20260713205821.736541F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alison.schofield@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.