From: sashiko-bot@kernel.org
To: "Raag Jadav" <raag.jadav@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v1] drm/xe/drm_ras: Protect against unplugged or wedged device
Date: Mon, 16 Nov 2026 09:07:25 +0000 [thread overview]
Message-ID: <sashiko-outbox-216583@kernel.org> (raw)
In-Reply-To: <20261116085343.1972825-1-raag.jadav@intel.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/ras: use-after-free in drm_ras_nl_list_nodes_dumpit()
[1]
--
commit f10baa8a8d01dd4d47e42403a4abd3c074961edc
Author: Raag Jadav <raag.jadav@intel.com>
drm/xe/drm_ras: Protect against unplugged or wedged device
This commit adds drm_dev_enter() and xe_wedged() checks around DRM RAS
counter and threshold callbacks and event reporting to prevent accesses on
unplugged or wedged devices.
> diff --git a/drivers/gpu/drm/xe/xe_drm_ras.c b/drivers/gpu/drm/xe/xe_drm_ras.c
> index 7554803aae11a..c0c1acb84e890 100644
> --- a/drivers/gpu/drm/xe/xe_drm_ras.c
> +++ b/drivers/gpu/drm/xe/xe_drm_ras.c
> @@ -5,6 +5,7 @@
>
> #include <linux/bitmap.h>
>
> +#include <drm/drm_drv.h>
> #include <drm/drm_managed.h>
> #include <drm/drm_print.h>
> #include <drm/drm_ras.h>
> @@ -12,10 +13,33 @@
> #include "xe_device_types.h"
> #include "xe_drm_ras.h"
> #include "xe_ras.h"
> +#include "xe_wedge.h"
>
> static const char * const error_components[] = DRM_XE_RAS_ERROR_COMPONENT_NAMES;
> static const char * const error_severity[] = DRM_XE_RAS_ERROR_SEVERITY_NAMES;
>
> +static int drm_ras_counter_get(struct xe_device *xe, struct xe_drm_ras_counter *info,
> + u32 error_id, int *idx)
> +{
> + if (xe_wedged(xe))
> + return -ECANCELED;
> +
> + if (!info || !info[error_id].name)
> + return -ENOENT;
> +
> + /* Must be last */
> + if (!drm_dev_enter(&xe->drm, idx))
> + return -ENODEV;
[Severity: Critical]
This problem wasn't introduced by this patch, but can
drm_ras_nl_list_nodes_dumpit() race with device teardown and trigger a
use-after-free or NULL pointer dereference on node and node->device_name
[1]?
CPU0 CPU1
cleanup_node() drm_ras_nl_list_nodes_dumpit()
xa_for_each_start(&drm_ras_xa, ...)
drm_ras_node_unregister(node)
xa_erase(&drm_ras_xa, node->id)
cleanup_node_param(node)
kfree(node->device_name)
node->device_name = NULL
/* node freed via drmm */
nla_put_u32(..., node->id)
nla_put_string(...,
node->device_name) <-- UAF / NULL
drm_ras_nl_family enables parallel_ops, and xa_for_each_start() only holds
rcu_read_lock() inside xa_find() and xa_find_after(), returning node to the
loop body without any lock, RCU protection, or reference held. Meanwhile,
cleanup_node() in xe_drm_ras.c unregisters the node with xa_erase(), frees
and clears node->device_name, and lets drmm free the drm_ras_node itself, so
a concurrent netlink dump can dereference NULL in strlen() or read freed
memory.
[1] https://sashiko.dev/#/bug/linux-f54f18de-e95f-4d99-b86c-f90c2c59b668
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116085343.1972825-1-raag.jadav@intel.com?part=1
next prev parent reply other threads:[~2026-11-16 9:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 8:53 [PATCH v1] drm/xe/drm_ras: Protect against unplugged or wedged device Raag Jadav
2026-11-16 9:07 ` sashiko-bot [this message]
2026-11-16 9:25 ` ✓ CI.KUnit: success for " Patchwork
2026-11-16 9:57 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-16 13:55 ` ✓ Xe.CI.FULL: " Patchwork
2026-11-16 23:28 ` [PATCH v1] " Summers, Stuart
2026-11-17 8:50 ` Raag Jadav
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=sashiko-outbox-216583@kernel.org \
--to=sashiko-bot@kernel.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.