All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Clear fence channel in no-signaling path
@ 2026-09-28  8:14 ` Beomseok Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Beomseok Kim @ 2026-09-28  8:14 UTC (permalink / raw)
  To: nouveau
  Cc: dakr, maarten.lankhorst, mripard, simona, dri-devel, linux-kernel,
	Beomseok Kim, stable

nouveau_fence_signal() clears fence->channel before dropping its
reference.  nouveau_fence_no_signaling(), however, removes an already
signaled fence from fctx->pending without clearing the pointer.

The fence can remain attached to a BO reservation object and be used
later in nouveau_fence_sync() after channel teardown has freed the
channel.  This leaves a stale channel pointer that the sync path can
dereference.

A diagnostic build with concurrent short-lived Wayland GL clients
observed nouveau_fence_no_signaling() with a fence pointing to channel
C, nouveau_channel_del(C) returning, and then nouveau_fence_sync()
attempting to read C->cli.  A no-fault read failed after teardown.

Clear the pointer in nouveau_fence_no_signaling() to match
nouveau_fence_signal(), so the sync path uses the fence wait fallback.

Fixes: 29ba89b2371d ("drm/nouveau: rework to new fence interface")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Beomseok Kim <dilddream31@gmail.com>
---
 drivers/gpu/drm/nouveau/nouveau_fence.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
index edbe9e08b..5b09cf134 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -488,6 +488,7 @@ static bool nouveau_fence_no_signaling(struct dma_fence *f)
 	 */
 	if (nouveau_fence_is_signaled(f)) {
 		list_del(&fence->head);
+		rcu_assign_pointer(fence->channel, NULL);
 
 		dma_fence_put(&fence->base);
 		return false;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-13 13:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-28  8:14 [PATCH] drm/nouveau: Clear fence channel in no-signaling path Beomseok Kim
2026-09-28  8:14 ` Beomseok Kim
2026-10-15  9:10 ` 김범석
2026-10-15  9:10   ` 김범석
2026-10-15 10:40   ` 김범석
2026-10-15 10:40     ` 김범석
2026-10-23 17:19     ` lyude
2026-10-23 17:19       ` lyude
2026-11-12 21:40 ` Marek Czernohous
2026-11-12 21:40   ` Marek Czernohous
2026-11-13 13:00   ` Fab Stz
2026-11-13 13:00     ` Fab Stz

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.