From: sashiko-bot@kernel.org
To: "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/nouveau: Simplify nouveau_cli_work
Date: Fri, 12 Jun 2026 17:01:28 +0000 [thread overview]
Message-ID: <20260612170129.AED001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260612165409.54447-1-tvrtko.ursulin@igalia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] The patch introduces a use-after-free vulnerability by reading `work->fence` after calling `work->func(work)`, which frees the `work` structure.
--
commit 5f500d0384ad49806cf724c1cd7f76a580d6bc42
Author: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
drm/nouveau: Simplify nouveau_cli_work
This patch simplifies the nouveau_cli_work function by removing the
nouveau_cli_work_ready wrapper. As part of this cleanup, the
dma_fence_put() call is moved to execute after the work callback
has been invoked.
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index e16f59b00f6fa..a3e38a30fbdab 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
[ ... ]
> @@ -176,9 +160,10 @@ nouveau_cli_work(struct work_struct *w)
> struct nouveau_cli_work *work, *wtmp;
> mutex_lock(&cli->lock);
> list_for_each_entry_safe(work, wtmp, &cli->worker, head) {
> - if (!work->fence || nouveau_cli_work_ready(work->fence)) {
> + if (!work->fence || dma_fence_is_signaled(work->fence)) {
> list_del(&work->head);
> work->func(work);
> + dma_fence_put(work->fence);
[Severity: Critical]
Does moving dma_fence_put() after work->func() introduce a use-after-free
here?
Looking at the callback implementation in nouveau_gem_object_delete_work()
(in drivers/gpu/drm/nouveau/nouveau_gem.c), the work structure is freed:
nouveau_gem_object_delete_work(...)
{
...
nouveau_gem_object_delete(work->vma);
kfree(work);
}
If the callback frees the work structure, accessing work->fence immediately
afterwards in dma_fence_put() would read from freed memory.
> }
> }
> mutex_unlock(&cli->lock);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260612165409.54447-1-tvrtko.ursulin@igalia.com?part=1
next prev parent reply other threads:[~2026-06-12 17:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 16:54 [PATCH] drm/nouveau: Simplify nouveau_cli_work Tvrtko Ursulin
2026-06-12 16:54 ` Tvrtko Ursulin
2026-06-12 17:01 ` sashiko-bot [this message]
2026-06-12 17:14 ` Philipp Stanner
2026-06-12 17:14 ` Philipp Stanner
2026-06-12 17:18 ` Tvrtko Ursulin
2026-06-12 17:18 ` Tvrtko Ursulin
2026-06-12 17:29 ` Tvrtko Ursulin
2026-06-12 17:29 ` Tvrtko Ursulin
2026-06-12 17:22 ` [PATCH v2] " Tvrtko Ursulin
2026-06-12 17:22 ` Tvrtko Ursulin
2026-06-12 17:33 ` sashiko-bot
2026-06-15 9:26 ` [PATCH v3] " Tvrtko Ursulin
2026-06-15 9:26 ` Tvrtko Ursulin
2026-06-15 9:31 ` Philipp Stanner
2026-06-15 9:31 ` Philipp Stanner
2026-06-21 15:29 ` Danilo Krummrich
2026-06-21 15:29 ` Danilo Krummrich
2026-06-21 15:30 ` Danilo Krummrich
2026-06-21 15:30 ` Danilo Krummrich
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=20260612170129.AED001F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tvrtko.ursulin@igalia.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 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.