Re: [PATCH 04/11] drm/panthor: Fix potential invalid pointer deref in group_process_tiler_oom()
From: Liviu Dudau
Date: Fri Jun 26 2026 - 05:15:26 EST
On Thu, Jun 25, 2026 at 02:40:30PM +0200, Boris Brezillon wrote:
> If heaps is an ERR_PTR(), panthor_heap_pool_put() will deref an invalid
> pointer. Make sure we set it to NULL in that case.
>
> Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
> Reported-by: sashiko-bot@xxxxxxxxxx
> Closes: https://sashiko.dev/#/patchset/20260625-panthor-signal-from-irq-v5-0-8836a74e0ef9@xxxxxxxxxxxxx?part=2
> Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
Reviewed-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_sched.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index e97f29469d28..8fd4d97b062e 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -1600,7 +1600,10 @@ static int group_process_tiler_oom(struct panthor_group *group, u32 cs_id)
> if (unlikely(csg_id < 0))
> return 0;
>
> - if (IS_ERR(heaps) || frag_end > vt_end || vt_end >= vt_start) {
> + if (IS_ERR(heaps)) {
> + ret = -EINVAL;
> + heaps = NULL;
> + } else if (frag_end > vt_end || vt_end >= vt_start) {
> ret = -EINVAL;
> } else {
> /* We do the allocation without holding the scheduler lock to avoid
>
> --
> 2.54.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯