From: sashiko-bot@kernel.org
To: "Dave Jiang" <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH] cxl/features: Serialize multi-part Get/Set Feature transfers
Date: Thu, 09 Jul 2026 16:08:15 +0000 [thread overview]
Message-ID: <20260709160816.6C25B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709155841.1895915-1-dave.jiang@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Buffer overflow in `cxl_get_feature()` due to static `size_out` usage in multi-part transfers.
--
--- Patch [1]: [PATCH] cxl/features: Serialize multi-part Get/Set Feature transfers ---
commit a8495b40ab103b124442f90daa5b684383d16566
Author: Dave Jiang <dave.jiang@intel.com>
cxl/features: Serialize multi-part Get/Set Feature transfers
This patch introduces a per-mailbox feat_mutex to serialize multi-part
Get and Set Feature payload transfers. This ensures that concurrent accesses
from fwctl and EDAC paths cannot interleave parts and corrupt the device's
transfer context.
Link: https://sashiko.dev/#/patchset/20260702090849.47501-1-icheng@nvidia.com?part=1
Fixes: 5e5ac21f629d ("cxl/mbox: Add GET_FEATURE mailbox command")
Fixes: 14d502cc2718 ("cxl/mbox: Add SET_FEATURE mailbox command")
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index 85185af46b72d..85d6bcdc360ef 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -240,6 +240,8 @@ size_t cxl_get_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid,
> size_out = min(feat_out_size, cxl_mbox->payload_size);
> uuid_copy(&pi.uuid, feat_uuid);
> pi.selection = selection;
> +
> + guard(mutex)(&cxl_mbox->feat_mutex);
> do {
> data_to_rd_size = min(feat_out_size - data_rcvd_size,
> cxl_mbox->payload_size);
[Severity: Critical]
This is a pre-existing issue, but does this static size_out assignment risk
a buffer overflow on the final iteration?
In cxl_get_feature(), mbox_cmd.size_out is assigned the initial size_out
value on every loop iteration, rather than the dynamically bounded
data_to_rd_size:
mbox_cmd = (struct cxl_mbox_cmd) {
.opcode = CXL_MBOX_OP_GET_FEATURE,
.size_in = sizeof(pi),
.payload_in = &pi,
.size_out = size_out,
.payload_out = feat_out + data_rcvd_size,
.min_out = data_to_rd_size,
};
If the hardware returns more bytes than requested on the final iteration,
could the transport use this larger size_out bound to copy past the end of
the feat_out buffer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709155841.1895915-1-dave.jiang@intel.com?part=1
prev parent reply other threads:[~2026-07-09 16:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 15:58 [PATCH] cxl/features: Serialize multi-part Get/Set Feature transfers Dave Jiang
2026-07-09 16:08 ` 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=20260709160816.6C25B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dave.jiang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox