From: sashiko-bot@kernel.org
To: "Satyanarayana K V P" <satyanarayana.k.v.p@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v3 3/3] drm/xe/gt: Disable GT reset worker before engine teardown
Date: Fri, 09 Oct 2026 12:39:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-165551@kernel.org> (raw)
In-Reply-To: <20261009121921.818671-8-satyanarayana.k.v.p@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm/xe/gt: UAF in reset worker racing with GuC/GSC devres teardown
--
commit b50233919776c7d521074ae26d515654e814d647
Author: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
Subject: drm/xe/gt: Disable GT reset worker before engine teardown
This commit registers a GT-level devres action to disable and drain the
reset worker right after xe_hw_engines_init(). This aims to ensure the
worker is halted before any engine is torn down.
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c
[ ... ]
> @@ -656,6 +668,11 @@ static int gt_init_with_all_forcewake(struct xe_gt *gt)
> if (err)
> return err;
>
> + /* Disable worker before releasing HW engines */
> + err = devm_add_action_or_reset(gt_to_xe(gt)->drm.dev, gt_reset_worker_disable, gt);
[Severity: High]
Does this cause a use-after-free or NULL pointer dereference during teardown?
Because devres actions are executed in LIFO order, registering
gt_reset_worker_disable here means it will execute AFTER any devres actions
registered by subsequent initialization steps, such as
xe_uc_init_post_hwconfig().
Specifically, during GSC teardown, free_resources() destroys the workqueue:
drivers/gpu/drm/xe/xe_gsc.c:free_resources() {
...
if (gsc->wq) {
destroy_workqueue(gsc->wq);
gsc->wq = NULL;
}
}
Because this teardown happens before the reset worker is disabled, a
concurrently running reset worker can reach this point:
drivers/gpu/drm/xe/xe_gsc.c:xe_gsc_load_start() {
...
queue_work(gsc->wq, &gsc->work);
}
If the reset worker calls queue_work() while gsc->wq is freed or NULL, it
will cause a crash.
> + if (err)
> + return err;
> +
> err = xe_uc_init_post_hwconfig(>->uc);
> if (err)
> return err;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261009121921.818671-5-satyanarayana.k.v.p@intel.com?part=3
next prev parent reply other threads:[~2026-10-09 12:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 12:19 [PATCH v3 0/3] Fix kernel crash during driver teardown Satyanarayana K V P
2026-10-09 12:19 ` [PATCH v3 1/3] drm/xe: Prevent VF memory IRQ from accessing a torn-down engine Satyanarayana K V P
2026-10-09 12:29 ` sashiko-bot
2026-10-09 12:19 ` [PATCH v3 2/3] drm/xe/guc: Protect timeout handling from device unplug Satyanarayana K V P
2026-10-09 12:19 ` [PATCH v3 3/3] drm/xe/gt: Disable GT reset worker before engine teardown Satyanarayana K V P
2026-10-09 12:39 ` sashiko-bot [this message]
2026-10-09 13:07 ` ✓ CI.KUnit: success for Fix kernel crash during driver teardown (rev3) Patchwork
2026-10-09 14:34 ` ✓ Xe.CI.BAT: " 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=sashiko-outbox-165551@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=satyanarayana.k.v.p@intel.com \
/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