From: sashiko-bot@kernel.org
To: "Stuart Summers" <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 02/10] drm/xe: Sort xe_config_device fields
Date: Thu, 20 Aug 2026 20:20:46 +0000 [thread overview]
Message-ID: <20260820202046.AFF841F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260820200719.84681-14-stuart.summers@intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Returning pointers to dynamically allocated memory without holding a reference or lock leads to Use-After-Free during concurrent configfs rmdir.
--
--- Patch [2]: [PATCH 02/10] drm/xe: Sort xe_config_device fields ---
commit d57e5535d41e0295d705b408cd4efb54e4709623
Author: Stuart Summers <stuart.summers@intel.com>
Subject: drm/xe: Sort xe_config_device fields
This patch sorts the xe_config_device fields and configfs entries to keep
them clean and easy to manage, ordering them first by type and then by name
for readability.
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 0a85043a9dd01..cb6ab1fcb8c18 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
[ ... ]
> +u32 xe_configfs_get_ctx_restore_post_bb(struct pci_dev *pdev,
> + enum xe_engine_class class,
> + const u32 **cs)
> +{
> + struct xe_config_group_device *dev = find_xe_config_group_device(pdev);
> + u32 len;
> +
> + if (!dev)
> + return 0;
> +
> + scoped_guard(mutex, &dev->lock) {
> + *cs = dev->config.ctx_restore_post_bb[class].cs;
> + len = dev->config.ctx_restore_post_bb[class].len;
> + }
> + config_group_put(&dev->group);
> +
> + return len;
> +}
[Severity: High]
This is a pre-existing issue, but does this pattern expose the returned
*cs pointer to a use-after-free if the configfs item is concurrently removed?
The internal pointer dev->config.ctx_restore_post_bb[class].cs is extracted
and assigned to *cs, but the lock is released and the config_group reference
is dropped via config_group_put(&dev->group) before returning.
If a user removes the configfs directory (rmdir) concurrently, could the
memory be freed while a caller like setup_configfs_post_ctx_restore_bb()
is still trying to use it?
drivers/gpu/drm/xe/xe_lrc.c:setup_configfs_post_ctx_restore_bb() {
count = xe_configfs_get_ctx_restore_post_bb(to_pci_dev(xe->drm.dev),
hwe->class, &user_batch);
if (!count)
return 0;
/* ... */
memcpy(cmd, user_batch, count * sizeof(u32));
}
This exact same lifecycle synchronization pattern also appears in
xe_configfs_get_ctx_restore_mid_bb().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260820200719.84681-12-stuart.summers@intel.com?part=2
next prev parent reply other threads:[~2026-08-20 20:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 20:07 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-20 20:07 ` [PATCH 01/10] drm/xe: Guard configfs attribute reads in getters Stuart Summers
2026-08-20 20:19 ` sashiko-bot
2026-08-20 20:07 ` [PATCH 02/10] drm/xe: Sort xe_config_device fields Stuart Summers
2026-08-20 20:20 ` sashiko-bot [this message]
2026-08-20 20:07 ` [PATCH 03/10] drm/xe: Split out configfs data structures Stuart Summers
2026-08-20 20:07 ` [PATCH 04/10] drm/xe: Add a new debug focused configfs group Stuart Summers
2026-08-20 20:07 ` [PATCH 05/10] drm/xe: Move debug configfs entries to xe_configfs_debug.c Stuart Summers
2026-08-20 20:20 ` sashiko-bot
2026-08-20 20:07 ` [PATCH 06/10] drm/xe/guc: Add configfs support for guc_log_level Stuart Summers
2026-08-20 20:07 ` [PATCH 07/10] drm/xe/guc: Add support for NPK as a GuC log target Stuart Summers
2026-08-20 20:07 ` [PATCH 08/10] drm/xe: Add infrastructure for debug configfs parameters Stuart Summers
2026-08-20 20:19 ` sashiko-bot
2026-08-20 21:08 ` Summers, Stuart
2026-08-20 20:07 ` [PATCH 09/10] drm/xe: Migrate existing debug configfs entries to params infrastructure Stuart Summers
2026-08-20 20:07 ` [PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-08-20 20:14 ` ✗ CI.checkpatch: warning for Add new debug infrastructure for configfs (rev6) Patchwork
2026-08-20 20:16 ` ✓ CI.KUnit: success " Patchwork
2026-08-20 20:54 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-20 22:45 ` ✗ Xe.CI.FULL: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-08-20 21:06 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-20 21:06 ` [PATCH 02/10] drm/xe: Sort xe_config_device fields Stuart Summers
2026-08-20 21:24 ` sashiko-bot
2026-08-07 19:45 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-07 19:45 ` [PATCH 02/10] drm/xe: Sort xe_config_device fields Stuart Summers
2026-08-05 23:20 [PATCH 00/10] Add new debug infrastructure for configfs Stuart Summers
2026-08-05 23:20 ` [PATCH 02/10] drm/xe: Sort xe_config_device fields Stuart Summers
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=20260820202046.AFF841F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=stuart.summers@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