From: sashiko-bot@kernel.org
To: "Raag Jadav" <raag.jadav@intel.com>
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v6 2/5] drm/ras: Introduce error threshold
Date: Wed, 19 Aug 2026 13:54:52 +0000 [thread overview]
Message-ID: <20260819135452.C0CE01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818135304.497098-3-raag.jadav@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The drm_ras_node pointer returned by xa_load() is used without RCU protection or locking, leading to a Use-After-Free if the node is concurrently unregistered.
--
--- Patch [2]: [PATCH v6 2/5] drm/ras: Introduce error threshold ---
commit 4fde8387621a92c01fa74b45df16200c6e02bd2a
Author: Raag Jadav <raag.jadav@intel.com>
drm/ras: Introduce error threshold
Add get-error-threshold and set-error-threshold command support which
allows querying/setting error threshold of the counter. Threshold in RAS
context means the number of errors the hardware is expected to accumulate
before it raises them to software.
> diff --git a/drivers/gpu/drm/drm_ras.c b/drivers/gpu/drm/drm_ras.c
> --- a/drivers/gpu/drm/drm_ras.c
> +++ b/drivers/gpu/drm/drm_ras.c
[ ... ]
> +static int get_node_error_threshold(u32 node_id, u32 error_id, const char **name, u32 *threshold)
> +{
> + struct drm_ras_node *node;
> +
> + node = xa_load(&drm_ras_xa, node_id);
> + if (!node)
> + return -ENOENT;
> +
> + if (!node->query_error_threshold)
> + return -EOPNOTSUPP;
> +
> + if (error_id < node->error_counter_range.first || error_id > node->error_counter_range.last)
> + return -EINVAL;
> +
> + return node->query_error_threshold(node, error_id, name, threshold);
[Severity: High]
This is a pre-existing issue, but can this cause a use-after-free?
The drm_ras_node pointer returned by xa_load() is used without RCU protection
or locking. If the node is concurrently unregistered and freed, for example
during driver unbind, the node memory could be freed before we invoke
node->query_error_threshold(). This would result in a use-after-free on the
node pointer.
> +}
> +
> +static int set_node_error_threshold(u32 node_id, u32 error_id, u32 threshold)
> +{
> + struct drm_ras_node *node;
> +
> + node = xa_load(&drm_ras_xa, node_id);
> + if (!node)
> + return -ENOENT;
> +
> + if (!node->set_error_threshold)
> + return -EOPNOTSUPP;
> +
> + if (error_id < node->error_counter_range.first || error_id > node->error_counter_range.last)
> + return -EINVAL;
> +
> + return node->set_error_threshold(node, error_id, threshold);
[Severity: High]
This is a pre-existing issue, but does this suffer from the same concurrent
unregistration race?
If the node pointer from xa_load() is freed before we call
node->set_error_threshold(), this dereference could also access freed memory.
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818135304.497098-1-raag.jadav@intel.com?part=2
next prev parent reply other threads:[~2026-08-19 13:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 13:52 [PATCH v6 0/5] Introduce error threshold to drm_ras Raag Jadav
2026-08-18 13:52 ` [PATCH v6 1/5] drm/ras: Cancel and free message on get counter failure Raag Jadav
2026-08-19 13:54 ` sashiko-bot
2026-08-18 13:52 ` [PATCH v6 2/5] drm/ras: Introduce error threshold Raag Jadav
2026-08-19 13:54 ` sashiko-bot [this message]
2026-08-18 13:52 ` [PATCH v6 3/5] drm/xe/ras: Add support for " Raag Jadav
2026-08-18 13:52 ` [PATCH v6 4/5] drm/xe/drm_ras: Wire up error threshold callbacks Raag Jadav
2026-08-19 13:54 ` sashiko-bot
2026-08-18 13:52 ` [PATCH v6 5/5] drm/xe/sysctrl: Reuse xe_sysctrl_create_command() Raag Jadav
2026-08-18 15:15 ` ✗ CI.checkpatch: warning for Introduce error threshold to drm_ras (rev6) Patchwork
2026-08-18 15:17 ` ✓ CI.KUnit: success " Patchwork
2026-08-18 16:04 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-18 19:27 ` ✗ Xe.CI.FULL: failure " Patchwork
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=20260819135452.C0CE01F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=raag.jadav@intel.com \
--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.