* [PATCH] drm/panthor: Fix NULL pointer dereference in sync signal cleanup
@ 2026-11-13 9:44 Tuo Li
2026-11-13 10:05 ` Boris Brezillon
2026-11-16 12:43 ` Liviu Dudau
0 siblings, 2 replies; 3+ messages in thread
From: Tuo Li @ 2026-11-13 9:44 UTC (permalink / raw)
To: boris.brezillon, steven.price, liviu.dudau, maarten.lankhorst,
mripard, tzimmermann, airlied, simona
Cc: dri-devel, linux-kernel, Tuo Li
In panthor_submit_ctx_add_sync_signal(), drm_syncobj_find() may return
NULL. The function then jumps to err_free_sig_sync, where
panthor_sync_signal_free() unconditionally calls drm_syncobj_put() on
the NULL pointer, causing a NULL pointer dereference.
Check sig_sync->syncobj before calling drm_syncobj_put() to avoid the
NULL pointer dereference.
Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block")
Signed-off-by: Tuo Li <islituo@gmail.com>
---
drivers/gpu/drm/panthor/panthor_drv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
index dc8d0191aef4..8d73956530a8 100644
--- a/drivers/gpu/drm/panthor/panthor_drv.c
+++ b/drivers/gpu/drm/panthor/panthor_drv.c
@@ -364,7 +364,9 @@ panthor_sync_signal_free(struct panthor_sync_signal *sig_sync)
if (!sig_sync)
return;
- drm_syncobj_put(sig_sync->syncobj);
+ if (sig_sync->syncobj)
+ drm_syncobj_put(sig_sync->syncobj);
+
dma_fence_chain_free(sig_sync->chain);
dma_fence_put(sig_sync->fence);
kfree(sig_sync);
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Fix NULL pointer dereference in sync signal cleanup
2026-11-13 9:44 [PATCH] drm/panthor: Fix NULL pointer dereference in sync signal cleanup Tuo Li
@ 2026-11-13 10:05 ` Boris Brezillon
2026-11-16 12:43 ` Liviu Dudau
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2026-11-13 10:05 UTC (permalink / raw)
To: Tuo Li
Cc: steven.price, liviu.dudau, maarten.lankhorst, mripard,
tzimmermann, airlied, simona, dri-devel, linux-kernel
On Fri, 13 Nov 2026 17:44:56 +0800
Tuo Li <islituo@gmail.com> wrote:
> In panthor_submit_ctx_add_sync_signal(), drm_syncobj_find() may return
> NULL. The function then jumps to err_free_sig_sync, where
> panthor_sync_signal_free() unconditionally calls drm_syncobj_put() on
> the NULL pointer, causing a NULL pointer dereference.
>
> Check sig_sync->syncobj before calling drm_syncobj_put() to avoid the
> NULL pointer dereference.
I really wish we had consistent behavior on those _put() helpers. Most
of them check for NULL before calling kref_put(), but some don't,
unfortunately...
>
> Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block")
> Signed-off-by: Tuo Li <islituo@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index dc8d0191aef4..8d73956530a8 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -364,7 +364,9 @@ panthor_sync_signal_free(struct panthor_sync_signal *sig_sync)
> if (!sig_sync)
> return;
>
> - drm_syncobj_put(sig_sync->syncobj);
> + if (sig_sync->syncobj)
> + drm_syncobj_put(sig_sync->syncobj);
> +
> dma_fence_chain_free(sig_sync->chain);
> dma_fence_put(sig_sync->fence);
> kfree(sig_sync);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Fix NULL pointer dereference in sync signal cleanup
2026-11-13 9:44 [PATCH] drm/panthor: Fix NULL pointer dereference in sync signal cleanup Tuo Li
2026-11-13 10:05 ` Boris Brezillon
@ 2026-11-16 12:43 ` Liviu Dudau
1 sibling, 0 replies; 3+ messages in thread
From: Liviu Dudau @ 2026-11-16 12:43 UTC (permalink / raw)
To: Tuo Li
Cc: boris.brezillon, steven.price, maarten.lankhorst, mripard,
tzimmermann, airlied, simona, dri-devel, linux-kernel
On Fri, Nov 13, 2026 at 05:44:56PM +0800, Tuo Li wrote:
> In panthor_submit_ctx_add_sync_signal(), drm_syncobj_find() may return
> NULL. The function then jumps to err_free_sig_sync, where
> panthor_sync_signal_free() unconditionally calls drm_syncobj_put() on
> the NULL pointer, causing a NULL pointer dereference.
>
> Check sig_sync->syncobj before calling drm_syncobj_put() to avoid the
> NULL pointer dereference.
>
> Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block")
> Signed-off-by: Tuo Li <islituo@gmail.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index dc8d0191aef4..8d73956530a8 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -364,7 +364,9 @@ panthor_sync_signal_free(struct panthor_sync_signal *sig_sync)
> if (!sig_sync)
> return;
>
> - drm_syncobj_put(sig_sync->syncobj);
> + if (sig_sync->syncobj)
> + drm_syncobj_put(sig_sync->syncobj);
> +
> dma_fence_chain_free(sig_sync->chain);
> dma_fence_put(sig_sync->fence);
> kfree(sig_sync);
> --
> 2.43.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 12:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13 9:44 [PATCH] drm/panthor: Fix NULL pointer dereference in sync signal cleanup Tuo Li
2026-11-13 10:05 ` Boris Brezillon
2026-11-16 12:43 ` Liviu Dudau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®