From: sashiko-bot@kernel.org
To: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm: Provide a drm_dev_release_barrier() function to wait for device release callbacks
Date: Wed, 23 Sep 2026 14:21:14 +0000 [thread overview]
Message-ID: <20260923142114.D3D9C1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260923140844.390822-2-thomas.hellstrom@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] drm: NULL pointer dereference in drm_WARN_ON_ONCE on error path
--
commit 5d11ff8a335cc538f36d72b0645fb2d88466a4ce
Author: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Subject: drm: Provide a drm_dev_release_barrier() function to wait for device release callbacks
This commit adds a new drm_dev_release_barrier() function allowing drivers
to wait until all device release callbacks have finished executing. It uses
a driver-owned SRCU domain to synchronize completion of release actions.
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 0cdc606af8d18..df32821e693ac 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
[ ... ]
> +void drm_dev_release_barrier(const struct drm_driver *driver)
> +{
> + if (drm_WARN_ON_ONCE(NULL, !driver || !driver->release_srcu))
> + return;
[Severity: High]
Will passing NULL as the drm parameter to drm_WARN_ON_ONCE() cause a kernel
panic here?
If the warning condition is met, drm_WARN_ON_ONCE() passes the NULL pointer
to __drm_to_dev(), which returns NULL. This NULL pointer is then passed to
dev_driver_string() and dev_name().
Because dev_driver_string() unconditionally dereferences the dev pointer via
READ_ONCE(dev->driver), this transforms a non-fatal warning condition into an
immediate kernel crash on the error path instead of gracefully returning.
Should a standard WARN_ON_ONCE() be used here instead since no drm_device is
available in this context?
> +
> + synchronize_srcu(driver->release_srcu);
> +}
> +EXPORT_SYMBOL(drm_dev_release_barrier);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923140844.390822-1-thomas.hellstrom@linux.intel.com?part=1
next prev parent reply other threads:[~2026-09-23 14:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 14:08 [PATCH 0/3] drm, drm/xe: Protect against premature module unloads Thomas Hellström
2026-09-23 14:08 ` [PATCH 1/3] drm: Provide a drm_dev_release_barrier() function to wait for device release callbacks Thomas Hellström
2026-09-23 14:21 ` sashiko-bot [this message]
2026-09-23 14:08 ` [PATCH 2/3] drm/xe: Don't unload the driver until all drm devices are freed Thomas Hellström
2026-09-23 14:19 ` sashiko-bot
2026-09-23 14:08 ` [PATCH 3/3] drm/xe: Route deferred xe_vma/xe_vm teardown off system_dfl_wq Thomas Hellström
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=20260923142114.D3D9C1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=thomas.hellstrom@linux.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