All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Richard Cheng" <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org
Subject: Re: [PATCH v4 1/6] cxl/features: Reject feature offset that overflows 16-bit field
Date: Wed, 12 Aug 2026 11:52:13 +0000	[thread overview]
Message-ID: <20260812115213.7CE5A1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812112107.56181-2-icheng@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] fwctl ioctls falsely report SUCCESS to userspace when CXL mailbox transport encounters an internal error.
--

--- Patch [1]: [PATCH v4 1/6] cxl/features: Reject feature offset that overflows 16-bit field ---
commit 758deff635a1582bb94f5fac18c817ddd4966bdb
Author: Richard Cheng <icheng@nvidia.com>

cxl/features: Reject feature offset that overflows 16-bit field

This patch validates that the transfer size does not exceed the remaining 16-bit
feature range to prevent truncation when building mailbox command offsets. It
also changes cxl_get_feature() to return ssize_t so invalid input and mailbox
failures are reported as negative errno. Finally, it updates the EDAC callers
to handle negative results.

> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index ba6d2a5acb74a..8d44ce8294978 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
[ ... ]
> @@ -259,7 +262,7 @@ size_t cxl_get_feature(struct cxl_mailbox *cxl_mbox, const uuid_t *feat_uuid,
>  		if (rc < 0 || !mbox_cmd.size_out) {
>  			if (return_code)
>  				*return_code = mbox_cmd.return_code;
> -			return 0;
> +			return rc < 0 ? rc : -EIO;
>  		}

[Severity: High]
This isn't a bug introduced by this patch, but if cxl_internal_send_cmd()
fails with an OS-level error (rc < 0), it won't populate
mbox_cmd.return_code. Since mbox_cmd was initialized as a compound literal,
doesn't this set *return_code to 0 (CXL_MBOX_CMD_RC_SUCCESS)?

When this happens, cxlctl_get_feature() will absorb the negative error code
and pass the zeroed return_code back to fwctl:

drivers/cxl/core/features.c:cxlctl_get_feature() {
	...
	data_size = cxl_get_feature(..., &return_code);
	*out_len = sizeof(struct fwctl_rpc_cxl_out);
	if (data_size <= 0) {
		rpc_out->size = 0;
		rpc_out->retval = return_code;
		return no_free_ptr(rpc_out);
	}
	...
}

Does this result in fwctl ioctls falsely reporting SUCCESS to userspace when
the CXL mailbox transport encounters an internal error? This same pattern
appears to be present in cxl_set_feature() and cxlctl_set_feature() as well.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812112107.56181-1-icheng@nvidia.com?part=1

  reply	other threads:[~2026-08-12 11:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 11:21 [PATCH v4 0/6] cxl: Sashiko bug fixes Richard Cheng
2026-08-12 11:21 ` [PATCH v4 1/6] cxl/features: Reject feature offset that overflows 16-bit field Richard Cheng
2026-08-12 11:52   ` sashiko-bot [this message]
2026-08-12 11:21 ` [PATCH v4 2/6] cxl/region: Scan all partitions for unmapped poison Richard Cheng
2026-08-12 11:21 ` [PATCH v4 3/6] cxl/region: Don't leak tolerated RAM -EFAULT from unmapped poison scan Richard Cheng
2026-08-12 12:08   ` sashiko-bot
2026-08-12 11:21 ` [PATCH v4 4/6] cxl/region: Start unmapped poison scan at the committed decoder boundary Richard Cheng
2026-08-12 11:21 ` [PATCH v4 5/6] cxl/memdev: Don't overwrite the error from an earlier partition poison query Richard Cheng
2026-08-12 11:21 ` [PATCH v4 6/6] cxl/region: Reject poison scan for decoder without a partition Richard Cheng
2026-08-12 12:41   ` sashiko-bot

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=20260812115213.7CE5A1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=icheng@nvidia.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.