Linux CXL
 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 v5 3/7] cxl/region: Don't leak tolerated RAM -EFAULT from unmapped poison scan
Date: Thu, 13 Aug 2026 03:58:32 +0000	[thread overview]
Message-ID: <20260813035833.41BC81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813034538.13189-4-icheng@nvidia.com>

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

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the `cxl_get_poison_by_memdev()` function silently masks hardware errors from early partitions due to a missing error check.
--

--- Patch [3]: [PATCH v5 3/7] cxl/region: Don't leak tolerated RAM -EFAULT from unmapped poison scan ---
commit 4c4b3832747d23fff6bcb4486dc7105f329afd3d
Author: Richard Cheng <icheng@nvidia.com>
Subject: cxl/region: Don't leak tolerated RAM -EFAULT from unmapped poison scan

This commit fixes an issue where a tolerated error from a RAM partition
causes the unmapped poison scan to fail. It correctly resets the return
code to 0 when ignoring the fault, matching the behavior of
poison_by_decoder().

> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index b03f30c04d350..ddf12075b95c0 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -2930,8 +2930,10 @@ static int cxl_get_poison_unmapped(struct cxl_memdev *cxlmd,
>  		if (!length)
>  			continue;
>  		rc = cxl_mem_get_poison(cxlmd, offset, length, NULL);
> -		if (rc == -EFAULT && cxlds->part[i].mode == CXL_PARTMODE_RAM)
> +		if (rc == -EFAULT && cxlds->part[i].mode == CXL_PARTMODE_RAM) {
> +			rc = 0;
>  			continue;
> +		}
>  		if (rc)
>  			break;
>  	}

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this error
handling, I noticed a potential issue with similar logic in
cxl_get_poison_by_memdev() in drivers/cxl/core/memdev.c.

Does the loop in cxl_get_poison_by_memdev() mask hardware errors from
early partitions due to a missing error check?

drivers/cxl/core/memdev.c:cxl_get_poison_by_memdev() {
        ...
        for (int i = 0; i < cxlds->nr_partitions; i++) {
                ...
                rc = cxl_mem_get_poison(cxlmd, offset, length, NULL);
                /*
                 * Invalid Physical Address is not an error for
                 * volatile addresses. Device support is optional.
                 */
                if (rc == -EFAULT && cxlds->part[i].mode == CXL_PARTMODE_RAM)
                        rc = 0;
        }
        return rc;
}

If cxl_mem_get_poison() returns an error on an early partition, the loop
continues without breaking. Could a success on a subsequent partition then
overwrite rc with 0, masking the retrieval failure?

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

  reply	other threads:[~2026-08-13  3:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  3:45 [PATCH v5 0/7] cxl: Sashiko bug fixes Richard Cheng
2026-08-13  3:45 ` [PATCH v5 1/7] cxl/features: Reject feature offset that overflows 16-bit field Richard Cheng
2026-08-13  3:57   ` sashiko-bot
2026-08-13  3:45 ` [PATCH v5 2/7] cxl/region: Scan all partitions for unmapped poison Richard Cheng
2026-08-13  3:45 ` [PATCH v5 3/7] cxl/region: Don't leak tolerated RAM -EFAULT from unmapped poison scan Richard Cheng
2026-08-13  3:58   ` sashiko-bot [this message]
2026-08-13  3:45 ` [PATCH v5 4/7] cxl/region: Start unmapped poison scan at the committed decoder boundary Richard Cheng
2026-08-13  3:55   ` sashiko-bot
2026-08-13  3:45 ` [PATCH v5 5/7] cxl/memdev: Don't overwrite the error from an earlier partition poison query Richard Cheng
2026-08-13  4:01   ` sashiko-bot
2026-08-13  3:45 ` [PATCH v5 6/7] cxl/region: Reject poison scan for decoder without a partition Richard Cheng
2026-08-13  3:56   ` sashiko-bot
2026-08-13  3:45 ` [PATCH v5 7/7] cxl/fwctl: Propagate feature RPC delivery errors Richard Cheng

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=20260813035833.41BC81F000E9@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox